diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-02-22 19:56:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 19:56:41 +0100 |
commit | 279779062c5df0ef5780ed3dfadf87b606adaa71 (patch) | |
tree | da419acb2ce43c229185a276cb283fc3cba4fd86 | |
parent | fbb9700086eff42ed315be3d41c97860006ae9ae (diff) |
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
-rw-r--r-- | example/reader_util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index b16a1838c..6b22ef9cc 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1719,14 +1719,14 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, #ifdef DLT_IPV4 case DLT_IPV4: type = ETH_P_IP; - ip_offset = 0; + ip_offset = eth_offset; break; #endif #ifdef DLT_IPV6 case DLT_IPV6: type = ETH_P_IPV6; - ip_offset = 0; + ip_offset = eth_offset; break; #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))) wifi_len = 26; /* + 4 byte fcs */ } else /* no data frames */ - break; + return(nproto); /* Check ether_type from LLC */ 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; case DLT_RAW: - ip_offset = eth_offset = 0; + ip_offset = eth_offset; break; default: |