]> git.kaiwu.me - nginx.git/commitdiff
Fixed segfault on configuration testing with ssl (ticket #37).
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 31 Oct 2011 09:57:14 +0000 (09:57 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 31 Oct 2011 09:57:14 +0000 (09:57 +0000)
The following config caused segmentation fault due to conf->file not
being properly set if "ssl on" was inherited from the http level:

http {
    ssl on;
    server {
    }
}

src/http/modules/ngx_http_ssl_module.c

index 192fc3e35e1539fc690538baf81c54fe377bd383..f1f6a4ae4c84da317a153dd032b990fda33ad1a1 100644 (file)
@@ -346,7 +346,16 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
 
     ngx_pool_cleanup_t  *cln;
 
-    ngx_conf_merge_value(conf->enable, prev->enable, 0);
+    if (conf->enable == NGX_CONF_UNSET) {
+        if (prev->enable == NGX_CONF_UNSET) {
+            conf->enable = 0;
+
+        } else {
+            conf->enable = prev->enable;
+            conf->file = prev->file;
+            conf->line = prev->line;
+        }
+    }
 
     ngx_conf_merge_value(conf->session_timeout,
                          prev->session_timeout, 300);