Fixed segfault if an inappropriate file system object is requested.

Found by Coverity (CID 349483).
This commit is contained in:
Valentin Bartenev
2019-09-20 14:31:19 +03:00
parent 8853dece44
commit 5c50329f8e

View File

@@ -209,7 +209,6 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
/* Not a file. */ /* Not a file. */
nxt_file_close(task, f); nxt_file_close(task, f);
f = NULL;
if (nxt_slow_path(!nxt_is_dir(&fi))) { if (nxt_slow_path(!nxt_is_dir(&fi))) {
nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file", nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file",
@@ -218,6 +217,8 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
return NULL; return NULL;
} }
f = NULL;
r->status = NXT_HTTP_MOVED_PERMANENTLY; r->status = NXT_HTTP_MOVED_PERMANENTLY;
r->resp.content_length_n = 0; r->resp.content_length_n = 0;