Commit 4dee47b4 authored by Mikio Hara's avatar Mikio Hara

go.net/internal/icmp: make sure IPv6PseudoHeader takes only IPv6 addresses

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/142540044
parent cb96e72d
......@@ -16,8 +16,8 @@ const ipv6PseudoHeaderLen = 2*net.IPv6len + 8
// calculation.
func IPv6PseudoHeader(src, dst net.IP) []byte {
b := make([]byte, ipv6PseudoHeaderLen)
copy(b[:net.IPv6len], src)
copy(b[net.IPv6len:], dst)
copy(b, src.To16())
copy(b[net.IPv6len:], dst.To16())
b[len(b)-1] = byte(iana.ProtocolIPv6ICMP)
return b
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment