aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorLuca Deri <lucaderi@users.noreply.github.com>2020-02-28 14:39:17 +0100
committerGitHub <noreply@github.com>2020-02-28 14:39:17 +0100
commit9f72b15fffe21257910490ade8fb908659b01f54 (patch)
treeb8c62970596456666cb91a1a79a0ae07cf933ab3 /example/reader_util.c
parentd4c093e828ea0d361b185627101c6ab7d319485e (diff)
parent6fe95358812323fcf614fba8f8e5a43f43d164bb (diff)
Merge pull request #850 from catenacyber/fuzz4fix
Fuzz4fix
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 7ab060ef5..432dadbef 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1359,7 +1359,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
return(nproto);
}
- if(!flow->detection_completed) {
+ if(!flow->detection_completed && payload_len > 0) {
u_int enough_packets =
(((proto == IPPROTO_UDP) && ((flow->src2dst_packets + flow->dst2src_packets) > max_num_udp_dissected_pkts))
|| ((proto == IPPROTO_TCP) && ((flow->src2dst_packets + flow->dst2src_packets) > max_num_tcp_dissected_pkts))) ? 1 : 0;
@@ -1709,6 +1709,8 @@ ether_type_check:
}
if(workflow->prefs.decode_tunnels && (proto == IPPROTO_UDP)) {
+ if (header->caplen < ip_offset + ip_len + sizeof(struct ndpi_udphdr))
+ return(nproto); /* Too short for UDP header*/
struct ndpi_udphdr *udp = (struct ndpi_udphdr *)&packet[ip_offset+ip_len];
u_int16_t sport = ntohs(udp->source), dport = ntohs(udp->dest);