diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-05-13 21:00:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-13 21:00:53 +0000 |
commit | e1cfd3185c285f4dc69804210cc0d77ec582beb5 (patch) | |
tree | 866c789fcc0f67ec0933e3cf88fed6628e85b6f6 /pkg/tcpip/header/parse/parse.go | |
parent | f4d9f967005fdf7995439f56839cbb4a7589ff6c (diff) | |
parent | 84f04cc858644e9748a82f33b834a84c8b0fc934 (diff) |
Merge release-20210510.0-27-g84f04cc85 (automated)
Diffstat (limited to 'pkg/tcpip/header/parse/parse.go')
-rw-r--r-- | pkg/tcpip/header/parse/parse.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/tcpip/header/parse/parse.go b/pkg/tcpip/header/parse/parse.go index ebb4b2c1d..1c913b5e1 100644 --- a/pkg/tcpip/header/parse/parse.go +++ b/pkg/tcpip/header/parse/parse.go @@ -60,9 +60,13 @@ func IPv4(pkt *stack.PacketBuffer) bool { return false } ipHdr = header.IPv4(hdr) + length := int(ipHdr.TotalLength()) - len(hdr) + if length < 0 { + return false + } pkt.NetworkProtocolNumber = header.IPv4ProtocolNumber - pkt.Data().CapLength(int(ipHdr.TotalLength()) - len(hdr)) + pkt.Data().CapLength(length) return true } |