diff options
author | Tamir Duberstein <tamird@google.com> | 2019-03-27 14:35:49 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-27 14:36:57 -0700 |
commit | 8406504817b6749b2418cab5d9489a33a30dc799 (patch) | |
tree | f1c19e7466b828440f82012cd24885cb38579b41 | |
parent | 2d355f0e8fb8f7e72e6448fd4fcc4e79cdb6ba72 (diff) |
Avoid mutating memory passed to DeliverTransportPacket
PiperOrigin-RevId: 240642903
Change-Id: I16625015123a827d267d60b328a202057264bbd6
-rw-r--r-- | pkg/tcpip/network/ipv4/icmp.go | 1 |
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)) |