net: IP.{IsLinkLocalUnicast,IsLinkLocalMulticast,IsGlobalUnicast} false positives #11585
Labels
Milestone
Comments
Also panic()s if you pass an empty slice (e.g. net.ParseIP("garbage").IsLinkLocalUnicast()) |
It's intentional; don't call any methods on a nil value of net.IP. |
CL https://golang.org/cl/11883 mentions this issue. |
Thanks for the fix, looks clean to me.
|
Also IsGlobalUnicast(net.ParseIP("255.255.255.255")). |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I found this inspecting the code to understand the test.
http://play.golang.org/p/gXdT4o45uw
It looks like those methods are assuming that any IP they get is a 16 byte slice, but as far as I know a 4 byte slice is a valid IP.
The text was updated successfully, but these errors were encountered: