Skip to content

h3-proxy: fix NULL deref when non-:status header arrives before :status - #22449

Closed
SilentSobs wants to merge 1 commit into
curl:masterfrom
SilentSobs:fix-h3-proxy-null-deref
Closed

h3-proxy: fix NULL deref when non-:status header arrives before :status#22449
SilentSobs wants to merge 1 commit into
curl:masterfrom
SilentSobs:fix-h3-proxy-null-deref

Conversation

@SilentSobs

Copy link
Copy Markdown
Contributor

cb_h3_proxy_recv_header() only allocates pctx->tunnel.resp when it sees the :status pseudo-header. Any other header field is stored via pctx->tunnel.resp->headers without checking that resp was actually set, so a header arriving before :status (or a response with no :status at all) crashes with a NULL dereference.

Add a check for pctx->tunnel.resp before use, same as the non-proxy cb_h3_recv_header already does for its stream pointer.

Found via a libFuzzer harness driving curl's H3-proxy callbacks directly.

@bagder
bagder requested a review from icing July 30, 2026 20:53

@icing icing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems theoretical as :status has to be the first header in a response. But for the sake of defensive coding, it seems good to cope with a possible error in the http3 library.

@bagder bagder closed this in decc609 Jul 31, 2026
@bagder

bagder commented Jul 31, 2026

Copy link
Copy Markdown
Member

Thanks!

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.

3 participants