http: make Curl_compareheader handle multiple commas in header

For robustness
This commit is contained in:
Daniel Stenberg 2026-03-12 10:02:29 +01:00
parent ed7bfcd17d
commit 133b125b89
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -1449,7 +1449,11 @@ bool Curl_compareheader(const char *headerline, /* line to check */
if(curlx_str_until(&p, &next, MAX_HTTP_RESP_HEADER_SIZE, ',') ||
curlx_str_single(&p, ','))
break; /* no comma, get out */
curlx_str_passblanks(&p);
/* if there are more dummy commas, move over them as well */
do
curlx_str_passblanks(&p);
while(!curlx_str_single(&p, ','));
len -= (p - o);
}
}