Skip to content

ext/soap: Add test for Set-Cookie option parsing bug.#21400

Open
devnexen wants to merge 3 commits intophp:PHP-8.4from
devnexen:soap_cookie_bug
Open

ext/soap: Add test for Set-Cookie option parsing bug.#21400
devnexen wants to merge 3 commits intophp:PHP-8.4from
devnexen:soap_cookie_bug

Conversation

@devnexen
Copy link
Member

@devnexen devnexen commented Mar 9, 2026

The cookie option parser uses a wrong offset to start scanning attributes, causing cookie values containing substrings like "path=" or "domain=" to be falsely matched as attributes.

The cookie option parser uses a wrong offset to start scanning
attributes, causing cookie values containing substrings like
"path=" or "domain=" to be falsely matched as attributes.
- fix wrong cookie options offset calculation, using separator offset
  instead.
@devnexen devnexen marked this pull request as ready for review March 9, 2026 22:59
@devnexen devnexen requested a review from ndossche as a code owner March 9, 2026 22:59
Copy link
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

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

Nice find. Minor issue found though.

char *sempos = strstr(cookie, ";");
if (eqpos != NULL && (sempos == NULL || sempos > eqpos)) {
smart_str name = {0};
int cookie_len;
Copy link
Member

Choose a reason for hiding this comment

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

Removing this shadowed var is wrong: it will cause the loop advancement at line 1065 to be wrong: that line is supposed to skip the entire header value. Perhaps this shadowed variable should be renamed cookie_value_len.

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