Fix for crash if length of captured frame is less than Ethernet header size

This commit is contained in:
William Robinet 2021-01-21 09:57:27 +01:00
parent d1f8d01d4b
commit b3316bb5fd

View file

@ -176,6 +176,12 @@ void pcap_cb(ptr,hdr,data)
len-=4;
break;
case DLT_EN10MB:
if(len < sizeof(struct ether_header)) {
if(!(NET_print_flags & NET_PRINT_JSON))
printf("Frame size too small to contain Ethernet header, skipping ...\n");
return;
}
type=ntohs(e_hdr->ether_type);
data+=sizeof(struct ether_header);