diff options
| author | Valentin Bartenev <vbart@nginx.com> | 2019-09-20 14:31:19 +0300 |
|---|---|---|
| committer | Valentin Bartenev <vbart@nginx.com> | 2019-09-20 14:31:19 +0300 |
| commit | 5c50329f8edcbf3b56d9ffbc207eae64ca72e0fb (patch) | |
| tree | 043af5ccd46ac73a51ef6314115293d4be6897a6 /src/nxt_http_static.c | |
| parent | 8853dece44742043a669694fb6165a9932e1b8ff (diff) | |
| download | unit-5c50329f8edcbf3b56d9ffbc207eae64ca72e0fb.tar.gz unit-5c50329f8edcbf3b56d9ffbc207eae64ca72e0fb.tar.bz2 | |
Fixed segfault if an inappropriate file system object is requested.
Found by Coverity (CID 349483).
Diffstat (limited to 'src/nxt_http_static.c')
| -rw-r--r-- | src/nxt_http_static.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c index 44b85389..4679af5b 100644 --- a/src/nxt_http_static.c +++ b/src/nxt_http_static.c @@ -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; |
