[nginx] Fixed segfault in try_files with nested location.

Sergey Kandaurov pluknet at nginx.com
Wed Jun 7 15:51:54 UTC 2017


details:   http://hg.nginx.org/nginx/rev/6d0e0d982ec0
branches:  
changeset: 7027:6d0e0d982ec0
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Jun 07 18:46:35 2017 +0300
description:
Fixed segfault in try_files with nested location.

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.

diffstat:

 src/http/ngx_http_core_module.c |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r e699e6b6d76c -r 6d0e0d982ec0 src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c	Wed Jun 07 15:21:42 2017 +0300
+++ b/src/http/ngx_http_core_module.c	Wed Jun 07 18:46:35 2017 +0300
@@ -1353,6 +1353,7 @@ ngx_http_core_try_files_phase(ngx_http_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;
             }


More information about the nginx-devel mailing list