Skip to content

fix(mactrack): keep IPv6 text and binary addresses intact in xform_net_address() - #419

Merged
TheWitness merged 1 commit into
developfrom
fix/mactrack-net-address
Nov 12, 2026
Merged

TheWitness merged 1 commit into
developfrom
fix/mactrack-net-address

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

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, so 2001:db8::1 became 8193.3512.0.1, and a missing value passed null to trim().

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

…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>
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit d97342e into develop Nov 12, 2026
9 checks passed
@TheWitness
TheWitness deleted the fix/mactrack-net-address branch November 12, 2026 20:07
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.

Binary IP addresses ending in whitespace bytes are truncated Compressed IPv6 addresses are corrupted by xform_net_address

2 participants