From: sfd Date: Tue, 16 Apr 2013 02:54:03 +0000 (+1200) Subject: Fencepost error. X-Git-Tag: libpcap-1.5.0~56^2~19 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/db2ef8d3d63eeb13d84cb1ac6544afe94b4eada1 Fencepost error. If an ERF record has 0 'payload' bytes the last extension header will not be counted and the header length will be calculated incorrectly. --- diff --git a/pcap-dag.c b/pcap-dag.c index d006aa61..1a1ed18f 100644 --- a/pcap-dag.c +++ b/pcap-dag.c @@ -225,7 +225,7 @@ dag_erf_ext_header_count(uint8_t * erf, size_t len) do { /* sanity check we have enough bytes */ - if ( len <= (24 + (hdr_num * 8)) ) + if ( len < (24 + (hdr_num * 8)) ) return hdr_num; /* get the header type */