[httpd] Fix scan-build make warning from commit 3a03c74
Potential buffer overflow
This commit is contained in:
parent
1c62469a26
commit
19635e61ec
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue