Repository navigation
fix(mactrack): keep IPv6 text and binary addresses intact in xform_net_address() - #419
Merged
Merged
Conversation
…t_address() Convert raw 4 and 16 byte values before trimming, so a final whitespace byte is kept; return valid IP text as is, so compressed IPv6 is no longer read as hexadecimal IPv4; and cast the input, so a missing value no longer passes null to trim(). Fixes #355 Fixes #356 Ref #351 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
TheWitness
approved these changes
Nov 12, 2026
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.



xform_net_address()trimmed its input before checking for a raw 4 or 16 byte value, so a binary address whose last byte is whitespace (or NUL) lost that byte and was returned unconverted. It also read any short colon-separated value as hexadecimal IPv4, so2001:db8::1became8193.3512.0.1, and a missing value passednulltotrim().It now converts raw binary values before anything is trimmed, returns valid IPv4 or IPv6 text as it is, converts hexadecimal octets only when there are exactly four of them, and casts the input to a string. Malformed colon strings that used to turn into garbage dotted values are now returned unchanged. The new tests fail on develop and pass here.
Fixes #355
Fixes #356
Ref #351