Fix handling of IP packets with bogus IP header lengths

Credit to OSS-Fuzz for discovery
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34711
(Link to details becomes public 30 days after patch release)
This commit is contained in:
Tim Wojtulewicz 2021-05-27 16:33:50 -07:00
parent f861a194f9
commit 0e34f2e02f
5 changed files with 24 additions and 1 deletions

View file

@ -235,6 +235,13 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
packet->proto = proto;
// Double check the lengths one more time before forwarding this on.
if ( packet->ip_hdr->TotalLen() < packet->ip_hdr->HdrLen() )
{
Weird("bogus_IP_header_lengths", packet);
return false;
}
switch ( proto ) {
case IPPROTO_NONE:
// If the packet is encapsulated in Teredo, then it was a bubble and