From 62ead2a12cece59f1489b3272a5bde5572d08600 Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Mon, 12 May 2014 17:07:59 +0400 Subject: [PATCH] Fixed segmentation fault if http context is not defined. --- nginx/modsecurity/ngx_http_modsecurity.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index 7c1395315b..41f1e9b57b 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -938,6 +938,12 @@ ngx_http_modsecurity_init(ngx_conf_t *cf) static ngx_int_t ngx_http_modsecurity_init_process(ngx_cycle_t *cycle) { + if (ngx_http_cycle_get_module_main_conf(cycle, ngx_http_modsecurity) + == NULL) + { + return NGX_OK; + } + /* must set log hook here cf->log maybe changed */ modsecSetLogHook(cycle->log, modsecLog); modsecInitProcess();