diff --git a/CHANGES b/CHANGES index 081033b..62a5a1f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ v1.0.x - YYYY-MMM-DD (To be released) ------------------------------------- + - Exit more gracefully if uri length is zero + [@martinhsv] - Fixed obtaining of server_addr [Issue #167, #168 - @defanator] - Avoid processing of subrequests initiated by the error_page diff --git a/src/ngx_http_modsecurity_rewrite.c b/src/ngx_http_modsecurity_rewrite.c index 7ce4355..42bc855 100644 --- a/src/ngx_http_modsecurity_rewrite.c +++ b/src/ngx_http_modsecurity_rewrite.c @@ -150,6 +150,10 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r) if (n_uri == (char*)-1 || n_method == (char*)-1) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } + if (n_uri == NULL) { + dd("uri is of length zero"); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } old_pool = ngx_http_modsecurity_pcre_malloc_init(r->pool); msc_process_uri(ctx->modsec_transaction, n_uri, n_method, http_version); ngx_http_modsecurity_pcre_malloc_done(old_pool);