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

net: limit the size of ParseIP input? #43389

Open
bradfitz opened this issue Dec 26, 2020 · 1 comment
Open

net: limit the size of ParseIP input? #43389

bradfitz opened this issue Dec 26, 2020 · 1 comment
Labels

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Dec 26, 2020

Maybe net.ParseIP shouldn't successfully parse IP addresses out of unbounded inputs?

e.g. fmt.Println(net.ParseIP(strings.Repeat("0", 10<<20) + "000000192.0000168.00000.00001")) passes, as does UnmarshalText (https://play.golang.org/p/bXGEzOS6KVQ)

Of course, in both those cases the data is already fully in memory, so most the harm has been done if this is attacker-controlled.

Still, a bit surprising. Intentional?

Some parsers reject past 3 digits per octet, so 196.168.020.001 is valid, but not 0196.0168.0020.0001.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.