diff src/http/ngx_http_core_module.c @ 458:2e2b57743e87 NGINX_0_7_41

nginx 0.7.41 *) Bugfix: a segmentation fault might occur in worker process, if a "server_name" or a "location" directives had captures in regular expressions; the issue had appeared in 0.7.40. Thanks to Vladimir Sopot.
author Igor Sysoev <http://sysoev.ru>
date Wed, 11 Mar 2009 00:00:00 +0300
parents ca8f7f6cab16
children bb941a2996a6
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1380,9 +1380,9 @@ ngx_http_core_find_location(ngx_http_req
 
             if ((*clcfp)->captures && r->captures == NULL) {
 
-                len = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int);
-
-                r->captures = ngx_palloc(r->pool, len);
+                len = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
+
+                r->captures = ngx_palloc(r->pool, len * sizeof(int));
                 if (r->captures == NULL) {
                     return NGX_ERROR;
                 }