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: SIGSEGV in networkNumberAndMask #14131

Closed
ffontaine opened this issue Jan 28, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@ffontaine
Copy link

commented Jan 28, 2016

In function networkNumberAndMask of src/net/ip.go, if n is NULL then n.IP.To4() will cause a segmentation fault.
n should be check against NULL at the start of this function.

  •   if n == nil {
    
  •           return nil, nil
    
  •   }
    

@bradfitz bradfitz changed the title SIGSEGV in networkNumberAndMask net: SIGSEGV in networkNumberAndMask Jan 28, 2016

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

When would it be nil?

It's an internal function. What is calling it with a nil value?

Please provide a way to reproduce the problem.

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Jan 28, 2016

@ffontaine

This comment has been minimized.

Copy link
Author

commented Jan 28, 2016

Thanks for your quick reply, I encountered this issue when testing docker on a device with multiple interfaces. Some of them where up but with no ip adresses. The call to networkNumberAndMask was made by the String function of ip.go. However, as this internal function is also used by Contains in ip.go, I think it should be fixed inside networkNumberAndMask. I have not trace where docker made the call to String as I thought that the problem was inside Go. If needed, I can send more traces.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

Sounds like some code forgot an error check.

It's not valid to call String or Contains on a nil *IPNet.

@bradfitz bradfitz closed this Jan 28, 2016

@golang golang locked and limited conversation to collaborators Feb 3, 2017

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.