Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
};
static enum checksum_status
-pimv2_check_checksum(netdissect_options *ndo, const u_char *bp, const u_char *bp2, u_int len)
+pimv2_check_checksum(netdissect_options *ndo, const u_char *bp,
+ const u_char *bp2, u_int len)
{
const struct ip *ip;
u_int cksum;
+ if (!ND_TTEST2(bp[0], len)) {
+ /* We don't have all the data. */
+ return (UNVERIFIED);
+ }
ip = (const struct ip *)bp2;
if (IP_V(ip) == 4) {
struct cksum_vec vec[1];
heapoverflow-ppp_hdlc_if_print heapoverflow-ppp_hdlc_if_print.pcap heapoverflow-ppp_hdlc_if_print.out -t -v -n
heapoverflow-sl_if_print heapoverflow-sl_if_print.pcap heapoverflow-sl_if_print.out -t -v -n
heapoverflow-ip_print_demux heapoverflow-ip_print_demux.pcap heapoverflow-ip_print_demux.out -t -v -n
+heapoverflow-in_checksum heapoverflow-in_checksum.pcap heapoverflow-in_checksum.out -t -v -n
--- /dev/null
+IP (tos 0x30, ttl 48, id 12336, offset 0, flags [DF], proto PIM (103), length 12336, bad cksum 3030 (->2947)!)
+ 48.48.48.48 > 48.48.48.48: PIMv2, length 12316
+ Hello, RFC2117-encoding, cksum 0x3030 (unverified)[|pim]