mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
icmp: fix ListenPacket panic
Fixes golang/go#32933 Change-Id: I837d6a54e51d91ff3260ec7e1c79412c52dff20d Reviewed-on: https://go-review.googlesource.com/c/net/+/185317 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
42ef8dbebe
commit
4ba9e2ef06
@@ -50,6 +50,9 @@ func ListenPacket(network, address string) (*PacketConn, error) {
|
||||
family, proto = syscall.AF_INET6, iana.ProtocolIPv6ICMP
|
||||
default:
|
||||
i := last(network, ':')
|
||||
if i < 0 {
|
||||
i = len(network)
|
||||
}
|
||||
switch network[:i] {
|
||||
case "ip4":
|
||||
proto = iana.ProtocolICMP
|
||||
|
||||
Reference in New Issue
Block a user