Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ip4Address parser: reject 0-prefixed components #9538

Merged
merged 2 commits into from Aug 9, 2021

Conversation

jedisct1
Copy link
Contributor

@jedisct1 jedisct1 commented Aug 8, 2021

Octal is hardly useful to anything besides file permissions, but aging standards still use it.

127.0.026.1 can be parsed as 127.0.22.1, not 127.0.26.1.

Some parsers support octal, some don't, and the confusion can lead to vulnerabilities.

Reject 0-prefixed IPv4 components. This align to what the Go language did to fix CVE-2021-29923.

@jedisct1
Copy link
Contributor Author

jedisct1 commented Aug 8, 2021

Good watch for reference:

https://www.youtube.com/watch?v=_o1RPJAe4kU

@jedisct1 jedisct1 added the standard library This issue involves writing Zig code for the standard library. label Aug 8, 2021
@jedisct1 jedisct1 changed the title Ip4Address parser: components must support octal representation Ip4Address parser: reject 0-prefixed components Aug 8, 2021
Some parsers interpret these as octal, some don't, and the
confusion can lead to vulnerabilities.

Return error.NonCanonical when parsing IPv4 addresses with 0 prefixes
@jedisct1 jedisct1 merged commit 2ccd023 into ziglang:master Aug 9, 2021
@jedisct1 jedisct1 deleted the octal-ipv4 branch August 9, 2021 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant