summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2019-03-27 14:35:49 -0700
committerShentubot <shentubot@google.com>2019-03-27 14:36:57 -0700
commit8406504817b6749b2418cab5d9489a33a30dc799 (patch)
treef1c19e7466b828440f82012cd24885cb38579b41 /pkg/tcpip/network
parent2d355f0e8fb8f7e72e6448fd4fcc4e79cdb6ba72 (diff)
Avoid mutating memory passed to DeliverTransportPacket
PiperOrigin-RevId: 240642903 Change-Id: I16625015123a827d267d60b328a202057264bbd6
Diffstat (limited to 'pkg/tcpip/network')
-rw-r--r--pkg/tcpip/network/ipv4/icmp.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/tcpip/network/ipv4/icmp.go b/pkg/tcpip/network/ipv4/icmp.go
index 7fd63c117..8f94246c9 100644
--- a/pkg/tcpip/network/ipv4/icmp.go
+++ b/pkg/tcpip/network/ipv4/icmp.go
@@ -69,6 +69,7 @@ func (e *endpoint) handleICMP(r *stack.Route, netHeader buffer.View, vv buffer.V
// It's possible that a raw socket expects to receive this.
e.dispatcher.DeliverTransportPacket(r, header.ICMPv4ProtocolNumber, netHeader, vv)
+ vv := vv.Clone(nil)
vv.TrimFront(header.ICMPv4EchoMinimumSize)
hdr := buffer.NewPrependable(int(r.MaxHeaderLength()) + header.ICMPv4EchoMinimumSize)
pkt := header.ICMPv4(hdr.Prepend(header.ICMPv4EchoMinimumSize))