]> git.kaiwu.me - nginx.git/commitdiff
Fixed segfault in try_files with nested location.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 15:46:35 +0000 (18:46 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 15:46:35 +0000 (18:46 +0300)
If memory allocation of a new r->uri.data storage failed, reset its length as
well.  Request URI is used in ngx_http_finalize_request() for debug logging.

src/http/ngx_http_core_module.c

index 7e40e7860fba05f1a709208cf0f3c844239de4e0..b5be1ffeb66f3fa63abff18be966bf681f595820 100644 (file)
@@ -1353,6 +1353,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
             r->uri.len = alias + path.len;
             r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
             if (r->uri.data == NULL) {
+                r->uri.len = 0;
                 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
                 return NGX_OK;
             }