Modify vsnprintf condition checks for size#11878
Conversation
Updated conditions in vsnprintf checks to include equality. Signed-off-by: vast0906 <vast0906@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTwo small fixes in SDS formatting: flb_sds_printf tightens the vsnprintf insatiable check at available-space boundaries; flb_sds_snprintf returns on negative vsnprintf and adjusts buffer-growth math (ret >= size, grow by ret - size + 1, set size = ret + 1). ChangesSDS Buffer Boundary Handling
🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs:
Suggested labels: Suggested reviewers:
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/flb_sds.c`:
- Around line 405-414: The vsnprintf retry path in flb_sds_snprintf can
mis-handle negative returns and leaks the va_list on error; after calling
vsnprintf (in the retry_snprintf block) first check if ret < 0 and if so call
va_end(va) and return -1, then perform the resize check using a size-safe
comparison (e.g. if ((size_t)ret >= size) or cast ret to size_t) before
computing the grow amount; also ensure any early returns (like tmp == NULL) call
va_end(va) before returning; update references to flb_sds_increase and the
va_list handling in flb_sds_snprintf accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Signed-off-by: vast0906 <vast0906@gmail.com>
|
Actionable comments posted: 0 |
Fixes #11876
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit