]> git.kaiwu.me - nginx.git/commitdiff
Reset of r->uri.len on URI parsing errors.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 18 Jul 2014 16:02:11 +0000 (20:02 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 18 Jul 2014 16:02:11 +0000 (20:02 +0400)
This ensures that debug logging and the $uri variable (if used in
400 Bad Request processing) will not try to access uninitialized
memory.

Found by Sergey Bobrov.

src/http/ngx_http_request.c

index 4bf9d1fcf1c73cc3f1ce0e22649a1a657ee429ff..845ada322e32e31c4fa7661877dc424a4e3770db 100644 (file)
@@ -1071,6 +1071,8 @@ ngx_http_process_request_uri(ngx_http_request_t *r)
         cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
 
         if (ngx_http_parse_complex_uri(r, cscf->merge_slashes) != NGX_OK) {
+            r->uri.len = 0;
+
             ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                           "client sent invalid request");
             ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);