From da2b2c647d7a4f7399878826ccab980b1e396a67 Mon Sep 17 00:00:00 2001 From: Eldar Zaitov Date: Wed, 14 May 2014 19:36:21 +0400 Subject: [PATCH 1/2] fix nginx crash issue #681 --- nginx/modsecurity/apr_bucket_nginx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginx/modsecurity/apr_bucket_nginx.c b/nginx/modsecurity/apr_bucket_nginx.c index 62eb59a733..87d4a5924b 100644 --- a/nginx/modsecurity/apr_bucket_nginx.c +++ b/nginx/modsecurity/apr_bucket_nginx.c @@ -215,9 +215,11 @@ move_brigade_to_chain(apr_bucket_brigade *bb, ngx_chain_t **ll, ngx_pool_t *pool } cl->buf->last_buf = 1; + cl->next = NULL; *ll = cl; } else { cl->buf->last_buf = 1; + cl->next = NULL; } apr_brigade_cleanup(bb); return NGX_OK; From b3db7d33b9d8b211b920cb2b70b410353fc1bcf4 Mon Sep 17 00:00:00 2001 From: Eldar Zaitov Date: Wed, 14 May 2014 19:41:09 +0400 Subject: [PATCH 2/2] fix empty hostname in log file --- nginx/modsecurity/ngx_http_modsecurity.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index 7c1395315b..d42ee14a2d 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -252,6 +252,8 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r) req->parsed_uri.path = (char *)ngx_pstrdup0(r->pool, &r->uri); req->parsed_uri.is_initialized = 1; + req->parsed_uri.hostname = (char *)ngx_pstrdup0(r->pool, &r->headers_in.host); + str.data = r->port_start; str.len = r->port_end - r->port_start; req->parsed_uri.port = ngx_atoi(str.data, str.len);