mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Check for valid ip_hdr length before trying to make a Val out of it
This commit is contained in:
parent
8d7a156109
commit
b9f63173bc
3 changed files with 14 additions and 2 deletions
|
@ -142,7 +142,7 @@ RecordValPtr Packet::ToRawPktHdrVal() const
|
|||
|
||||
pkt_hdr->Assign(0, std::move(l2_hdr));
|
||||
|
||||
if ( l3_proto == L3_IPV4 || l3_proto == L3_IPV6 )
|
||||
if ( ip_hdr && cap_len >= ip_hdr->TotalLen() && (l3_proto == L3_IPV4 || l3_proto == L3_IPV6) )
|
||||
// Packet analysis will have stored the IP header in the packet, so we can use
|
||||
// that to build the output.
|
||||
return ip_hdr->ToPktHdrVal(std::move(pkt_hdr), 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue