Skip to content

tool_operhlp: avoid NULL to %s#21836

Closed
bagder wants to merge 2 commits into
masterfrom
bagder/curl-default-filename
Closed

tool_operhlp: avoid NULL to %s#21836
bagder wants to merge 2 commits into
masterfrom
bagder/curl-default-filename

Conversation

@bagder

@bagder bagder commented Jun 2, 2026

Copy link
Copy Markdown
Member

If the filename allocation fails.

Reported-by: Gao Liyou
Ref: #21825

If the filename allocation fails.

Reported-by: Gao Liyou
Ref: #21825
@bagder bagder marked this pull request as ready for review June 2, 2026 06:19
@bagder bagder requested a review from Copilot June 2, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a potential undefined-behavior case in the curl tool helper logic by ensuring a NULL pointer from a failed filename allocation is no longer formatted via %s in a warning message.

Changes:

  • Introduce a DEFAULT_FILENAME constant for the fallback remote filename.
  • Avoid passing a potentially-NULL *filename into warnf() formatting by using the constant string directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tool_operhlp.c Outdated
@bagder bagder closed this in b825417 Jun 2, 2026
@bagder bagder deleted the bagder/curl-default-filename branch June 2, 2026 06:49
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
If the filename allocation fails.

Reported-by: Gao Liyou
Ref: curl#21825
Closes curl#21836
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