Conversation
The spec allows it and this is an oversight.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughIn ChangesO_VSIO vendor option parsing relaxation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 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 docstrings
🧪 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/if-options.c`:
- Around line 962-965: The variable `fp` can be set to NULL in the
vendorcode-only path (when the else branch executes), but it is later used in a
format string with the %s specifier in the size-error logging path, which causes
undefined behavior. Add a NULL guard before using `fp` in any logging statements
that include it as a format string argument. Replace the NULL `fp` value with a
safe string literal (such as an empty string or a descriptive placeholder) in
the log message to prevent crashes when the format string is processed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| if (p != NULL) | ||
| fp = p + 1; | ||
| else | ||
| fp = NULL; |
There was a problem hiding this comment.
Guard %s logging against fp == NULL in vendorcode-only path.
After allowing missing payloads, fp can be NULL, but it is later formatted with %s in the size-error path. That introduces undefined behavior and can crash on some libc/log implementations.
Suggested fix
- if (opt_header + dl > opt_max) {
- logerrx("vsio is too big: %s", fp);
+ if (opt_header + dl > opt_max) {
+ logerrx("vsio is too big: %s", fp != NULL ? fp : "");
free(np);
return -1;
}Also applies to: 1031-1033
🤖 Prompt for 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.
In `@src/if-options.c` around lines 962 - 965, The variable `fp` can be set to
NULL in the vendorcode-only path (when the else branch executes), but it is
later used in a format string with the %s specifier in the size-error logging
path, which causes undefined behavior. Add a NULL guard before using `fp` in any
logging statements that include it as a format string argument. Replace the NULL
`fp` value with a safe string literal (such as an empty string or a descriptive
placeholder) in the log message to prevent crashes when the format string is
processed.
The spec allows it and this is an oversight.