Merge remote-tracking branch 'origin/fastpath'

* origin/fastpath:
  Add check for truncated link frames.  Addresses #962.
  Fix large memory allocation in IP fragment reassembly.  Addresses #961.
This commit is contained in:
Robin Sommer 2013-03-13 07:18:22 -07:00
commit b4824f4207
4 changed files with 22 additions and 1 deletions

View file

@ -1,4 +1,12 @@
2.1-361 | 2013-03-13 07:18:22 -0700
* Add check for truncated link frames. Addresses #962. (Jacob
Baines)
* Fix large memory allocation in IP fragment reassembly. Addresses
#961. (Jacob Baines)
2.1-357 | 2013-03-08 09:18:35 -0800 2.1-357 | 2013-03-08 09:18:35 -0800
* Fix race-condition in table-event test. (Bernhard Amann) * Fix race-condition in table-event test. (Bernhard Amann)

View file

@ -1 +1 @@
2.1-357 2.1-361

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 )

View file

@ -223,6 +223,12 @@ void NetSessions::NextPacket(double t, const struct pcap_pkthdr* hdr,
// we look to see if what we have is consistent with an // we look to see if what we have is consistent with an
// IPv4 packet. If not, it's either ARP or IPv6 or weird. // IPv4 packet. If not, it's either ARP or IPv6 or weird.
if ( hdr_size > static_cast<int>(hdr->caplen) )
{
Weird("truncated_link_frame", hdr, pkt);
return;
}
uint32 caplen = hdr->caplen - hdr_size; uint32 caplen = hdr->caplen - hdr_size;
if ( caplen < sizeof(struct ip) ) if ( caplen < sizeof(struct ip) )
{ {