Repository navigation
Reject null value pointers in execution-context setters - #214
Closed
shengwen0928 wants to merge 1 commit into
Closed
shengwen0928 wants to merge 1 commit into
shengwen0928 wants to merge 1 commit into
Conversation
Five extern "C" setters in ffi/src/lib.rs read value pointers without validating them. A null JSON pointer was read from address 0 and a null IPv4 or IPv6 value was dereferenced. The two setters guarded by assert aborted on a (NULL, 0) call instead. The setters now return false and record a last error when a non-empty value pointer is null, and a zero-length value is treated as empty. The IPv4 and IPv6 setters take a raw pointer instead of a reference so the null check is sound. The generated C header is unchanged. All five setters are wrapped in catch_panic, matching wirefilter_parse_filter and wirefilter_match. A regression test passes NULL to each setter and checks that it returns false with a last error set, that a (NULL, 0) bytes value is accepted as empty, and that the execution context still accepts a valid value afterwards.
Collaborator
|
Thank you for your interest in wirefilter. We are not likely to merge this as the ffi layer will be deleted soon and is not maintained anymore. |
Author
|
Understood, thank you for letting me know — and for maintaining wirefilter. I'll close this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #194
Five extern "C" setters in ffi/src/lib.rs read value pointers without validating them. A null JSON pointer was read from address 0 and a null IPv4 or IPv6 value was dereferenced. The two setters guarded by assert aborted on a (NULL, 0) call instead.
The setters now return false and record a last error when a non-empty value pointer is null, and a zero-length value is treated as empty. The IPv4 and IPv6 setters take a raw pointer instead of a reference so the null check is sound. The generated C header is unchanged. All five setters are wrapped in catch_panic, matching wirefilter_parse_filter and wirefilter_match.
A regression test passes NULL to each setter and checks that it returns false with a last error set, that a (NULL, 0) bytes value is accepted as empty, and that the execution context still accepts a valid value afterwards.
Verification