Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
make sure to prevent modsecurity use pcre_malloc and pcre_free directly
nginx with pcre prevent original pcre_malloc and pcre_free ngx_http_modsecurity_pcre_malloc_init/done is required before call pcre.
  • Loading branch information
Liu Dongmiao committed Sep 15, 2022
commit 2b8425e1f12ebd3bfb2328f2349cd901a743d528
2 changes: 2 additions & 0 deletions src/ngx_http_modsecurity_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ static ngx_int_t ngx_http_modsecurity_init_process(ngx_cycle_t *cycle) {
ngx_log_t *log = cycle->log;
ngx_uint_t log_level = log->log_level;
log->log_level = NGX_LOG_NOTICE;
ngx_pool_t *old_pool = ngx_http_modsecurity_pcre_malloc_init(mmcf->pool);
for (cleanup = cycle->pool->cleanup; cleanup; cleanup = cleanup->next) {
if (cleanup->handler == ngx_http_modsecurity_cleanup_rules) {
ngx_http_modsecurity_conf_t *mcf = cleanup->data;
Expand All @@ -648,6 +649,7 @@ static ngx_int_t ngx_http_modsecurity_init_process(ngx_cycle_t *cycle) {
}
}
}
ngx_http_modsecurity_pcre_malloc_done(old_pool);
log->log_level = log_level;
return NGX_OK;
}
Expand Down