Skip to content

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

Merged
iliaal merged 1 commit into
php:masterfrom
iliaal:soap-protorel-redirect-leak
Jun 24, 2026
Merged

soap: do not overwrite the parsed host on a protocol-relative redirect#22431
iliaal merged 1 commit into
php:masterfrom
iliaal:soap-protorel-redirect-leak

Conversation

@iliaal

@iliaal iliaal commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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 #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.
@iliaal iliaal merged commit 5cd9a3b into php:master Jun 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants