Skip to content

http: avoid length underflow in Curl_compareheader - #22338

Closed
GrahamCampbell wants to merge 1 commit into
curl:masterfrom
GrahamCampbell:fix-compareheader-underflow
Closed

http: avoid length underflow in Curl_compareheader#22338
GrahamCampbell wants to merge 1 commit into
curl:masterfrom
GrahamCampbell:fix-compareheader-underflow

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Contributor

Since curl 8.20.0, the comma scan in Curl_compareheader subtracts the bytes consumed in each round from the remaining value length, but skipping trailing blanks can move the parsing point past the trimmed value end, wrapping the unsigned length. The scan then continues beyond the value and can match a token after an embedded newline. This adds a guard that stops the loop at the value end, with new unit 1625 cases covering both shapes.

@github-actions github-actions Bot added the tests label Jul 16, 2026
@bagder bagder closed this in f0f84d1 Jul 20, 2026
@bagder

bagder commented Jul 20, 2026

Copy link
Copy Markdown
Member

Thanks!

@GrahamCampbell
GrahamCampbell deleted the fix-compareheader-underflow branch July 20, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants