Sfoglia il codice sorgente

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

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/142540044
Mikio Hara 11 anni fa
parent
commit
4dee47b476
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      internal/icmp/ipv6.go

+ 2 - 2
internal/icmp/ipv6.go

@@ -16,8 +16,8 @@ const ipv6PseudoHeaderLen = 2*net.IPv6len + 8
 // calculation.
 // calculation.
 func IPv6PseudoHeader(src, dst net.IP) []byte {
 func IPv6PseudoHeader(src, dst net.IP) []byte {
 	b := make([]byte, ipv6PseudoHeaderLen)
 	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)
 	b[len(b)-1] = byte(iana.ProtocolIPv6ICMP)
 	return b
 	return b
 }
 }