Skip to content

soap: do not overwrite the parsed host on a protocol-relative redirect#110

Open
iliaal wants to merge 1 commit into
masterfrom
soap-protorel-redirect-leak
Open

soap: do not overwrite the parsed host on a protocol-relative redirect#110
iliaal wants to merge 1 commit into
masterfrom
soap-protorel-redirect-leak

Conversation

@iliaal

@iliaal iliaal commented Jun 21, 2026

Copy link
Copy Markdown
Owner

When a redirect Location is a protocol-relative reference (//host/path), the URI parser already fills new_uri->host, but the scheme-less redirect handling overwrote it with a copy of the request host without releasing the parsed one. That leaks a zend_string per such redirect (valgrind: 40 bytes definitely lost, traced to the Location parse) and pins the redirect back to the original host instead of the one the server named. Inherit host and port from the request URI only when new_uri->host is NULL, mirroring the scheme guard directly above. Follow-up to the scheme-less redirect handling added in php#22341.

When a redirect Location is a protocol-relative reference (//host/path),
the URI parser already fills new_uri->host, but the scheme-less redirect
handling overwrote it with a copy of the request host without releasing
the parsed one. That leaks a zend_string per such redirect and pins the
redirect back to the original host instead of the one the server named.
Inherit host and port from the request URI only when new_uri->host is
NULL, mirroring the scheme guard directly above.
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