From 8406504817b6749b2418cab5d9489a33a30dc799 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 27 Mar 2019 14:35:49 -0700 Subject: Avoid mutating memory passed to DeliverTransportPacket PiperOrigin-RevId: 240642903 Change-Id: I16625015123a827d267d60b328a202057264bbd6 --- pkg/tcpip/network/ipv4/icmp.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg') 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)) -- cgit v1.2.3