# HG changeset patch # User Igor Sysoev # Date 1258398698 0 # Node ID d8228f0b5113eb965b94274f3ead9587350e4c35 # Parent 1aed55182ea286313085789bdb203c4859c68b23 evaluate maximum captures size on configuration phase diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -2759,6 +2759,10 @@ ngx_http_core_init_main_conf(ngx_conf_t 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; } diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -1759,7 +1759,7 @@ ngx_http_regex_exec(ngx_http_request_t * 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));