Skip to content

Conversation

@rsmarples
Copy link
Member

Should fix #577.

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Walkthrough

Adds explicit NULL checks and guards in the vendor-option (O_VSIO/O_VSIO6) parsing path in src/if-options.c to prevent dereferencing NULL pointers returned by strwhite()/strskipwhite() when parsing malformed configuration lines.

Changes

Cohort / File(s) Summary
NULL pointer hardening in vendor-option parsing
src/if-options.c
Replaces implicit truthy pointer checks with explicit != NULL comparisons for results of strwhite()/strskipwhite(); guards subsequent whitespace-skipping, comma parsing, and null-termination operations to avoid NULL dereferences; preserves original error paths and overall control flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preventing NULL pointer assumptions for vsio options that lack arguments, which directly addresses issue #577.
Description check ✅ Passed The description references issue #577, which contains the objective of fixing NULL pointer dereference in the vsio/vendor-option parsing logic.
Linked Issues check ✅ Passed The code changes add explicit NULL pointer checks in vsio/vendor-option parsing to prevent strskipwhite() being called with NULL, directly addressing the segfault reported in issue #577.
Out of Scope Changes check ✅ Passed All changes are confined to the vsio/vendor-option parsing path in src/if-options.c and directly target the NULL dereference issue, with no unrelated modifications present.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 844c377 and 220f68c.

📒 Files selected for processing (1)
  • src/if-options.c
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/if-options.c
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: openbsd
  • GitHub Check: netbsd (--disable-dhcp6)
  • GitHub Check: netbsd
  • GitHub Check: netbsd (--disable-ipv4)
  • GitHub Check: netbsd (--disable-ipv4, -DSMALL)
  • GitHub Check: netbsd (-DSMALL)
  • GitHub Check: netbsd (--disable-ipv4ll)
  • GitHub Check: netbsd (--disable-ipv4ll, -DSMALL)
  • GitHub Check: netbsd (--disable-dhcp6, -DSMALL)
  • GitHub Check: netbsd (--disable-ipv6)
  • GitHub Check: netbsd (--disable-ipv6, -DSMALL)
  • GitHub Check: netbsd (--disable-arp, -DSMALL)
  • GitHub Check: netbsd (--disable-arp)
  • GitHub Check: freebsd

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33df3ed and 844c377.

📒 Files selected for processing (1)
  • src/if-options.c
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: netbsd (--disable-ipv4)
  • GitHub Check: netbsd (--disable-ipv4ll, -DSMALL)
  • GitHub Check: netbsd (--disable-dhcp6)
  • GitHub Check: netbsd (--disable-ipv6, -DSMALL)
  • GitHub Check: netbsd (--disable-arp)
  • GitHub Check: netbsd (--disable-ipv4ll)
  • GitHub Check: netbsd (--disable-ipv6)
  • GitHub Check: netbsd (--disable-ipv4, -DSMALL)
  • GitHub Check: netbsd (--disable-dhcp6, -DSMALL)
  • GitHub Check: netbsd (-DSMALL)
  • GitHub Check: netbsd (--disable-arp, -DSMALL)
  • GitHub Check: netbsd
  • GitHub Check: openbsd
  • GitHub Check: freebsd
🔇 Additional comments (1)
src/if-options.c (1)

938-940: LGTM - NULL check prevents dereference.

The explicit NULL check before null-terminating the string is correct and improves safety.

@rsmarples rsmarples merged commit cd0b269 into master Dec 31, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dhcpcd/src/if-options.c NULL Pointer Dereference in strskipwhite

2 participants