diff --git a/src/ngx_http_modsecurity_common.h b/src/ngx_http_modsecurity_common.h index 60218c4..a5ce60c 100644 --- a/src/ngx_http_modsecurity_common.h +++ b/src/ngx_http_modsecurity_common.h @@ -140,8 +140,13 @@ extern ngx_module_t ngx_http_modsecurity_module; int ngx_http_modsecurity_process_intervention (Transaction *transaction, ngx_http_request_t *r, ngx_int_t early_log); ngx_http_modsecurity_ctx_t *ngx_http_modsecurity_create_ctx(ngx_http_request_t *r); char *ngx_str_to_char(ngx_str_t a, ngx_pool_t *p); +#if (NGX_PCRE2) +#define ngx_http_modsecurity_pcre_malloc_init(x) NULL +#define ngx_http_modsecurity_pcre_malloc_done(x) (void)x +#else ngx_pool_t *ngx_http_modsecurity_pcre_malloc_init(ngx_pool_t *pool); void ngx_http_modsecurity_pcre_malloc_done(ngx_pool_t *old_pool); +#endif /* ngx_http_modsecurity_body_filter.c */ ngx_int_t ngx_http_modsecurity_body_filter_init(void); diff --git a/src/ngx_http_modsecurity_module.c b/src/ngx_http_modsecurity_module.c index b6f33f5..5c341e2 100644 --- a/src/ngx_http_modsecurity_module.c +++ b/src/ngx_http_modsecurity_module.c @@ -38,6 +38,7 @@ static void ngx_http_modsecurity_cleanup_rules(void *data); * https://github.com/openresty/lua-nginx-module/blob/master/src/ngx_http_lua_pcrefix.c */ +#if !(NGX_PCRE2) static void *(*old_pcre_malloc)(size_t); static void (*old_pcre_free)(void *ptr); static ngx_pool_t *ngx_http_modsec_pcre_pool = NULL; @@ -103,6 +104,7 @@ ngx_http_modsecurity_pcre_malloc_done(ngx_pool_t *old_pool) pcre_free = old_pcre_free; } } +#endif /* * ngx_string's are not null-terminated in common case, so we need to convert