Navigation Menu

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
Closed

net: SIGSEGV in networkNumberAndMask #14131

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

Comments

@ffontaine
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

Sounds like some code forgot an error check.

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

@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.
Projects
None yet
Development

No branches or pull requests

4 participants