[httpd] Fix scan-build make warning from commit 3a03c74

Potential buffer overflow
This commit is contained in:
ejurgensen 2021-03-15 21:59:40 +01:00
parent 1c62469a26
commit 19635e61ec
1 changed files with 1 additions and 2 deletions

View File

@ -389,7 +389,6 @@ serve_file(struct evhttp_request *req, const char *uri)
return;
}
if (!realpath(path, deref))
{
DPRINTF(E_LOG, L_HTTPD, "Could not dereference %s: %s\n", path, strerror(errno));
@ -420,7 +419,7 @@ serve_file(struct evhttp_request *req, const char *uri)
if (S_ISDIR(sb.st_mode))
{
slashed = (path[strlen(path) - 1] == '/');
strncat(path, ((slashed) ? "index.html" : "/index.html"), sizeof(path) - strlen(path));
strncat(path, ((slashed) ? "index.html" : "/index.html"), sizeof(path) - strlen(path) - 1);
if (!realpath(path, deref))
{