Conversation
Enforce we have a buffer and it is terminated. Rework code so that we no longer assert.
|
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)
Walkthrough
Changesscript_buftoenv() Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 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/script.c`:
- Around line 167-171: The code in script_buftoenv() checks if len is zero but
does not validate that buf is not NULL before dereferencing it at buf[len - 1].
Add a NULL pointer check for buf before accessing buf[len - 1] to prevent
crashes when NULL is passed with a non-zero length. Additionally, set errno when
returning NULL in the zero-length case to avoid callers encountering stale error
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Enforce we have a buffer and it is terminated.
Rework code so that we no longer assert.
Reported by NVIDIA Project Vanessa