-
-
Notifications
You must be signed in to change notification settings - Fork 7k
content_encoding: avoid strcpy #20072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Build list with dynbuf.
|
augment review |
There was a problem hiding this comment.
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 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 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build list with dynbuf.