Fix large memory allocation in IP fragment reassembly. Addresses #961.

Patch by jbaines modified slightly to return earlier so that the
problem packet can't cause any state change in the FragReassembler.
This commit is contained in:
Jon Siwek 2013-03-11 10:54:51 -05:00
parent 0075973249
commit 8d5434ef2d

View file

@ -100,6 +100,13 @@ void FragReassembler::AddFragment(double t, const IP_Hdr* ip, const u_char* pkt)
int offset = ip->FragOffset(); int offset = ip->FragOffset();
int len = ip->TotalLen(); int len = ip->TotalLen();
int hdr_len = ip->HdrLen(); int hdr_len = ip->HdrLen();
if ( len < hdr_len )
{
s->Weird("fragment_protocol_inconsistency", ip);
return;
}
int upper_seq = offset + len - hdr_len; int upper_seq = offset + len - hdr_len;
if ( ! offset ) if ( ! offset )