From 8a8041170e69af0d89fe429534c2ae5b9994d70d 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 fd8a69fa..215f65fc 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -1083,6 +1083,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();