Fixed segfault if an inappropriate file system object is requested.
Found by Coverity (CID 349483).
This commit is contained in:
@@ -209,7 +209,6 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
|
||||
/* Not a file. */
|
||||
|
||||
nxt_file_close(task, f);
|
||||
f = NULL;
|
||||
|
||||
if (nxt_slow_path(!nxt_is_dir(&fi))) {
|
||||
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;
|
||||
}
|
||||
|
||||
f = NULL;
|
||||
|
||||
r->status = NXT_HTTP_MOVED_PERMANENTLY;
|
||||
r->resp.content_length_n = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user