Skip to content

Add pool callback#3517

Open
JonathanBerrew wants to merge 1 commit intoowasp-modsecurity:v2/masterfrom
JonathanBerrew:Add-pool-callback
Open

Add pool callback#3517
JonathanBerrew wants to merge 1 commit intoowasp-modsecurity:v2/masterfrom
JonathanBerrew:Add-pool-callback

Conversation

@JonathanBerrew
Copy link
Copy Markdown

This is a Marc Stern modification, I don't have much more insight on the code he made. To be reviewed with caution and check if this is still relevant

@sonarqubecloud
Copy link
Copy Markdown

@airween airween requested a review from Copilot April 22, 2026 15:35
@airween airween added the 2.x Related to ModSecurity version 2.x label Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates request-body pool initialization to propagate the parent pool’s APR abort callback to the newly created msc_reqbody_mp pool.

Changes:

  • Set msc_reqbody_mp’s abort function to match msr->mp via apr_pool_abort_set(apr_pool_abort_get(msr->mp), ...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apache2/msc_reqbody.c
Comment on lines 96 to 98
apr_pool_create(&msr->msc_reqbody_mp, NULL);

apr_pool_abort_set(apr_pool_abort_get(msr->mp), msr->msc_reqbody_mp);
/* Initialise request body processors, if any. */
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apr_pool_create(&msr->msc_reqbody_mp, NULL); returns an apr_status_t, but the result isn’t checked before calling apr_pool_abort_set(...) (and later using msr->msc_reqbody_mp). If pool creation fails, this will immediately dereference a NULL pool. Capture the return code, and on failure set *error_msg and return an error before using msr->msc_reqbody_mp.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.x Related to ModSecurity version 2.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants