]> git.kaiwu.me - nginx.git/commitdiff
evaluate maximum captures size on configuration phase
authorIgor Sysoev <igor@sysoev.ru>
Mon, 16 Nov 2009 19:11:38 +0000 (19:11 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 16 Nov 2009 19:11:38 +0000 (19:11 +0000)
src/http/ngx_http_core_module.c
src/http/ngx_http_variables.c

index 7ae49a686fdc71deeace6f25c78e72046bc24e0c..e6b1162a0d2a6e257e26699b266589c084158add 100644 (file)
@@ -2759,6 +2759,10 @@ ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf)
     cmcf->variables_hash_bucket_size =
                ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size);
 
+    if (cmcf->ncaptures) {
+        cmcf->ncaptures = (cmcf->ncaptures + 1) * 3;
+    }
+
     return NGX_CONF_OK;
 }
 
index 0289a64ac555456f3ee348fc53157bf40b39aef0..a2852b0dd084f8a2171c5a4dc9b681f25c7e6b7c 100644 (file)
@@ -1759,7 +1759,7 @@ ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, ngx_str_t *s)
     cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
 
     if (re->ncaptures) {
-        len = (cmcf->ncaptures + 1) * 3;
+        len = cmcf->ncaptures;
 
         if (r->captures == NULL) {
             r->captures = ngx_palloc(r->pool, len * sizeof(int));