]> git.kaiwu.me - nginx.git/commitdiff
Sub filter: fixed initialization in http{} level (ticket #791).
authorRoman Arutyunyan <arut@nginx.com>
Mon, 21 Sep 2015 20:08:34 +0000 (23:08 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Mon, 21 Sep 2015 20:08:34 +0000 (23:08 +0300)
If sub_filter directive was only specified at http{} level, sub filter
internal data remained uninitialized.  That would lead to a crash in runtime.

src/http/modules/ngx_http_sub_filter_module.c

index 0a4ff6d808a95315153a1b585ec89616c483ec9c..8ba75edb77dbc09eb7af0f1813e801f5f388e439 100644 (file)
@@ -853,8 +853,9 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child)
         conf->pairs = prev->pairs;
         conf->matches = prev->matches;
         conf->tables = prev->tables;
+    }
 
-    } else if (conf->dynamic == 0){
+    if (conf->pairs && conf->dynamic == 0 && conf->tables == NULL) {
         pairs = conf->pairs->elts;
         n = conf->pairs->nelts;