Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with malformed domain that contains a "/" character #1999

Merged
merged 2 commits into from Mar 26, 2018

Conversation

curtisdf
Copy link

Cookies where the domain contains a "/" character are triggering an exception with SetCookie::matchesDomain(). The issue is that the call to preg_quote() inside this function does not specify the regex delimiter being used, and so this character isn't getting escaped, which leads to a malformed pattern going into preg_match(). This can be triggered for example if the cookie improperly contains a URL, or if it appends a path after the hostname, such as in the following examples:

foo=bar; domain=example.com/
foo=bar; domain=http://www.example.com

@curtisdf
Copy link
Author

curtisdf commented Jan 31, 2018

This is interesting. Evidently this bug was fixed 4 years ago, but somehow the fix was reverted. See #526. The fix is legit though. preg_quote() really does need to be told which delimiter to use.

Also, #1720 is in reference to the same bug.

@sagikazarmark sagikazarmark self-requested a review February 5, 2018 01:35
@sagikazarmark sagikazarmark mentioned this pull request Feb 5, 2018
@sagikazarmark sagikazarmark added this to the 6.3.1 milestone Feb 16, 2018
@GrahamCampbell
Copy link
Member

👍

@sagikazarmark
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants