Skip to content

tool_help: guard category[2] access when category is bare "-" - #22957

Closed
MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:fix/tool-help-oob-read-bare-dash
Closed

MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:fix/tool-help-oob-read-bare-dash

Conversation

@MegaManSec

Copy link
Copy Markdown
Contributor

This PR patches a critical vulnerability, which happens when using curl --help -.

When category is "-" (length 1), category[1] is already the null terminator. The else-if on line 272 then reads category[2] without first confirming category[1] is non-null, producing a one-byte heap-buffer-overflow that ASan flags. Add the category[1] guard so the short-option path is only taken for exactly two-character inputs like "-x".

When category is "-" (length 1), category[1] is already the null
terminator.  The else-if on line 272 then reads category[2] without
first confirming category[1] is non-null, producing a one-byte
heap-buffer-overflow that ASan flags.  Add the category[1] guard so
the short-option path is only taken for exactly two-character inputs
like "-x".
@MegaManSec
MegaManSec force-pushed the fix/tool-help-oob-read-bare-dash branch from aa8d6e1 to 9fbb9ac Compare September 15, 2026 15:06
@MegaManSec

Copy link
Copy Markdown
Contributor Author

bounty?

@bagder bagder closed this in cba4a75 Sep 17, 2026
@MegaManSec
MegaManSec deleted the fix/tool-help-oob-read-bare-dash branch September 17, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants