mirror of
https://github.com/curl/curl.git
synced 2026-08-26 02:43:31 +03:00
cookie: check __Secure- and __Host- case sensitively when read from file
The header path matches these prefixes case sensitively, as 5af0165562
made it for cookie spec reasons, but the Netscape cookie-file path still
used a case-insensitive match. Align the file path so a differently
cased name like __secure-x is treated as an ordinary cookie instead of
being put through the prefix integrity checks.
Extended test 2311 to cover it.
Closes #22085
This commit is contained in:
parent
e44f1a1446
commit
fdd6ba3580
2 changed files with 9 additions and 5 deletions
|
|
@ -759,10 +759,12 @@ static CURLcode parse_netscape(struct Cookie *co,
|
|||
if(!co->name)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
else {
|
||||
/* For Netscape file format cookies we check prefix on the name */
|
||||
if(curl_strnequal("__Secure-", co->name, 9))
|
||||
/* For Netscape file format cookies we check prefix on the name.
|
||||
These prefixes are matched case sensitively, same as on the
|
||||
header path and as the 6265bis document specifies. */
|
||||
if(!strncmp("__Secure-", co->name, 9))
|
||||
co->prefix_secure = TRUE;
|
||||
else if(curl_strnequal("__Host-", co->name, 7))
|
||||
else if(!strncmp("__Host-", co->name, 7))
|
||||
co->prefix_host = TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue