Skip to content

mbstring: Fix memory leak in mail header parsing#78

Closed
iliaal wants to merge 1 commit into
masterfrom
leak-fix-mbstring-mail-headers
Closed

mbstring: Fix memory leak in mail header parsing#78
iliaal wants to merge 1 commit into
masterfrom
leak-fix-mbstring-mail-headers

Conversation

@iliaal
Copy link
Copy Markdown
Owner

@iliaal iliaal commented Jun 7, 2026

A mail header consisting of a field name with no value (the input ends right after the colon) leaves the fld_name zend_string allocated but never released, because the cleanup only runs when both fld_name and fld_val are set. Reproduces via mb_send_mail() with a header like "X-Leak:". Released in both the loop-body and end-of-input branches.

A header field name with no value (input ending at the colon) leaves
fld_name allocated but unreleased, since the cleanup blocks only fire
when both fld_name and fld_val are set. Release the dangling fld_name in
both the loop-body and end-of-input branches.
@iliaal
Copy link
Copy Markdown
Owner Author

iliaal commented Jun 7, 2026

Promoted upstream: php#22254

@iliaal iliaal closed this Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant