reader_util: fix infinite loop in packet dissection (#1454)
Found by oss-fuzz See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44944
This commit is contained in:
@@ -1719,14 +1719,14 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
|||||||
#ifdef DLT_IPV4
|
#ifdef DLT_IPV4
|
||||||
case DLT_IPV4:
|
case DLT_IPV4:
|
||||||
type = ETH_P_IP;
|
type = ETH_P_IP;
|
||||||
ip_offset = 0;
|
ip_offset = eth_offset;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DLT_IPV6
|
#ifdef DLT_IPV6
|
||||||
case DLT_IPV6:
|
case DLT_IPV6:
|
||||||
type = ETH_P_IPV6;
|
type = ETH_P_IPV6;
|
||||||
ip_offset = 0;
|
ip_offset = eth_offset;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1785,7 +1785,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
|||||||
(FCF_TO_DS(fc) == 0x0 && FCF_FROM_DS(fc)))
|
(FCF_TO_DS(fc) == 0x0 && FCF_FROM_DS(fc)))
|
||||||
wifi_len = 26; /* + 4 byte fcs */
|
wifi_len = 26; /* + 4 byte fcs */
|
||||||
} else /* no data frames */
|
} else /* no data frames */
|
||||||
break;
|
return(nproto);
|
||||||
|
|
||||||
/* Check ether_type from LLC */
|
/* Check ether_type from LLC */
|
||||||
if(header->caplen < (eth_offset + wifi_len + radio_len + sizeof(struct ndpi_llc_header_snap)))
|
if(header->caplen < (eth_offset + wifi_len + radio_len + sizeof(struct ndpi_llc_header_snap)))
|
||||||
@@ -1799,7 +1799,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DLT_RAW:
|
case DLT_RAW:
|
||||||
ip_offset = eth_offset = 0;
|
ip_offset = eth_offset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user