content_encoding: avoid strcpy - #20072
Closed
bagder wants to merge 5 commits into
Closed
Conversation
Build list with dynbuf.
Member
Author
|
augment review |
bagder
marked this pull request as ready for review
December 22, 2025 10:41
There was a problem hiding this comment.
Pull request overview
This PR refactors the content encoding list building to use dynamic buffers (dynbuf) instead of fixed-size buffers and strcpy operations. The changes improve memory safety by avoiding potential buffer overflows.
Key changes:
- Replaced
Curl_all_content_encodings()withCurl_get_content_encodings()that returns a dynamically allocated string - Eliminated fixed-size 256-byte stack buffer in favor of dynamic allocation
- Simplified error message to remove redundant encoding list generation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/content_encoding.h | Updated function signature to return CURLcode and use output parameter for string |
| lib/content_encoding.c | Refactored to build encoding list with dynbuf; simplified error message |
| lib/setopt.c | Updated caller to use new API with proper error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🤖 Augment PR SummarySummary: Refactors content-encoding name list generation to avoid fixed-size buffers/ Changes:
Technical Notes: Callers now need to handle ownership of the returned string and OOM behavior. 🤖 Was this summary useful? React with 👍 or 👎 |
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.
Build list with dynbuf.