Repository navigation
Conversation
A custom proxy header can have a non-empty name that becomes empty after trimming. An HTTP/1 header line can also start with a colon. Reject these inputs before they reach Curl_dynhds_add(), which requires a non-empty name. Keep custom proxy headers consistent with existing behavior by ignoring the malformed entry. Return CURLE_BAD_FUNCTION_ARGUMENT from the HTTP/1 parser. Add unit and proxy CONNECT regression coverage. Follow-up to 1c9f1f4 Ref: curl/curl-fuzzer#409
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The validation changes are correctly placed and covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Rejects empty HTTP header names before they reach Curl_dynhds_add() assertions.
Changes:
- Rejects colon-leading HTTP/1 headers.
- Ignores proxy headers whose names become empty after trimming.
- Adds regression coverage for both paths.
| File | Description |
|---|---|
lib/dynhds.c |
Rejects zero-length HTTP/1 header names. |
lib/http_proxy.c |
Skips empty trimmed proxy-header names. |
tests/unit/unit2602.c |
Tests rejection without header insertion. |
tests/data/test1428 |
Tests malformed proxy-header omission. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
icing
approved these changes
Oct 7, 2026
Member
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Curl_dynhds_add()requires a non-empty header name, but two HTTP paths could pass an empty one. A custom proxy header such as--proxy-header " : ignored"becomes empty after trimming, while an HTTP/1 header line beginning with:has a zero-length name from the outset. In debug builds, either path can reach the assertion inCurl_dynhds_add().Reject the invalid HTTP/1 line and ignore the malformed custom proxy header, consistent with the existing handling of unusable custom-header entries. The low-level assertion remains in place.
The abort was exposed by 1c9f1f4c3f88 (
dynhds: check size overflows, #23210), which added the non-empty-name assertion. Both malformed caller paths predate that check. curl-fuzzer CI found the regression.Add regression coverage for the parser and proxy CONNECT paths.
Tested with a debug CMake build:
tests/runtests.pl 2602 1428scripts/checksrc-all.plscripts/spacecheck.plscripts/badwords-all