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: IP.{IsLinkLocalUnicast,IsLinkLocalMulticast,IsGlobalUnicast} false positives #11585

Closed
thockin opened this issue Jul 4, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@thockin
Copy link

commented Jul 4, 2015

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.

@thockin

This comment has been minimized.

Copy link
Author

commented Jul 4, 2015

Also panic()s if you pass an empty slice (e.g. net.ParseIP("garbage").IsLinkLocalUnicast())

@mikioh mikioh changed the title stdlib: net.ip.IsLinkLocalUnicast() and .IsLinkLocalMulticast() false positives net: IP.IsLinkLocalUnicast() and .IsLinkLocalMulticast() false positives Jul 4, 2015

@mikioh mikioh added this to the Go1.5 milestone Jul 4, 2015

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2015

It's intentional; don't call any methods on a nil value of net.IP.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 4, 2015

CL https://golang.org/cl/11883 mentions this issue.

@thockin

This comment has been minimized.

Copy link
Author

commented Jul 4, 2015

Thanks for the fix, looks clean to me.
On Jul 3, 2015 9:59 PM, "Mikio Hara" notifications@github.com wrote:

It's intentional; don't call any methods on a nil value of net.IP.


Reply to this email directly or view it on GitHub
#11585 (comment).

@mikioh mikioh changed the title net: IP.IsLinkLocalUnicast() and .IsLinkLocalMulticast() false positives net: IP.{IsLinkLocalUnicast,IsLinkLocalMulticast,IsGlobalUnicast} false positives Jul 7, 2015

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2015

Also IsGlobalUnicast(net.ParseIP("255.255.255.255")).

@mikioh mikioh closed this in 91ba0ab Jul 10, 2015

@golang golang locked and limited conversation to collaborators Jul 11, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.