Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

panic: runtime error: slice bounds out of range #17

Open
greenpau opened this issue Jun 14, 2017 · 2 comments
Open

panic: runtime error: slice bounds out of range #17

greenpau opened this issue Jun 14, 2017 · 2 comments

Comments

@greenpau
Copy link

When running on MAC OSX:

sudo fbtracert -srcAddr 10.1.1.5 10.10.10.1

receiving the following error:

Starting fbtracert with 96 probes per second/ttl, base src port 32768 and with the port span of 256
Use '-logtostderr=true' cmd line option to see GLOG output
panic: runtime error: slice bounds out of range

goroutine 53 [running]:
main.ICMPReceiver.func1(0xc42000ddc0, 0x14, 0xc42000dd0b, 0xc4201430e0)
	/Users/greenpau/go/src/github.com/facebook/fbtracert/main.go:250 +0x443
created by main.ICMPReceiver
	/Users/greenpau/go/src/github.com/facebook/fbtracert/main.go:262 +0x237

That line is:

            glog.V(4).Infof("Received ICMP response message %d: %x\n", n, packet[:n])

The n at the point it breaks is (int) 152.

@greenpau
Copy link
Author

The packet is 128 and n is 152.

@greenpau
Copy link
Author

The packet object is limited to 128? ([]uint8) (len=128 cap=128)

Quick fix would be:

            if n > 128 {
                n = 128
            }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant