Skip to content

tool_setopt: return error on OOM correctly#21083

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/mime-oom
Closed

tool_setopt: return error on OOM correctly#21083
bagder wants to merge 1 commit intomasterfrom
bagder/mime-oom

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 24, 2026

When generating mime code for the --libcurl option.

Follow-up to acdb482

Spotted by Codex Security

When generating mime code for the --libcurl option.

Follow-up to acdb482

Spotted by Codex Security
@bagder bagder marked this pull request as ready for review March 24, 2026 09:09
@bagder bagder requested a review from Copilot March 24, 2026 09:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes out-of-memory handling when generating --libcurl output for MIME parts, ensuring OOM failures from string escaping are propagated as CURLE_OUT_OF_MEMORY rather than flowing into formatting/printing code paths.

Changes:

  • Add explicit c_escape() NULL checks and return CURLE_OUT_OF_MEMORY in MIME code generation paths.
  • Refactor escaped usage to avoid redeclarations while ensuring allocated escape buffers are freed on success paths.

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

@bagder bagder closed this in 18f8873 Mar 24, 2026
@bagder bagder deleted the bagder/mime-oom branch March 24, 2026 09:48
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