Skip to content

fix(NSC): add nil check for net.ParseIP result in mangle table rules#2036

Closed
Aprazor wants to merge 1 commit intocloudnativelabs:masterfrom
Aprazor:fix/mangle-rule-nil-parseip
Closed

fix(NSC): add nil check for net.ParseIP result in mangle table rules#2036
Aprazor wants to merge 1 commit intocloudnativelabs:masterfrom
Aprazor:fix/mangle-rule-nil-parseip

Conversation

@Aprazor
Copy link
Copy Markdown

@Aprazor Aprazor commented Mar 22, 2026

Both setupMangleTableRule and cleanupMangleTableRule call
net.ParseIP(ip) and immediately dereference the result with .To4()
without checking for nil. If a malformed IP string reaches these
functions, the nil dereference causes a panic. Add explicit nil
checks that return a descriptive error instead.

Both setupMangleTableRule and cleanupMangleTableRule call
net.ParseIP(ip) and immediately dereference the result with .To4()
without checking for nil. If a malformed IP string reaches these
functions, the nil dereference causes a panic. Add explicit nil
checks that return a descriptive error instead.
@aauren
Copy link
Copy Markdown
Collaborator

aauren commented Mar 23, 2026

Hi @Aprazor — please see my comment on #2020 (#2020 (comment)) for feedback on how to consolidate your PRs. Thanks!

@Aprazor
Copy link
Copy Markdown
Author

Aprazor commented Mar 23, 2026

Superseded by #2041 (consolidated NSC PR per @aauren's feedback)

@Aprazor Aprazor closed this Mar 23, 2026
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.

2 participants