From b97360d931d504a1c1fcfa7d2a8bb577e148be35 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 31 Jan 2020 15:26:34 +0100 Subject: Fix infinite loop in ndpi_workflow_process_packet --- example/reader_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index 8a6a0d637..eb73ee632 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1603,7 +1603,8 @@ ether_type_check: if(iph->protocol == IPPROTO_IPV6) { ip_offset += ip_len; - goto iph_check; + if (ip_len > 0) + goto iph_check; } if((frag_off & 0x1FFF) != 0) { -- cgit v1.2.3 From 0bf2ca56a8f62059e8e3eebf931537ec75fefef3 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 31 Jan 2020 15:37:36 +0100 Subject: Uses ip_size in get_ndpi_flow_info6 --- example/reader_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index eb73ee632..2236f79d3 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -898,6 +898,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info6(struct ndpi_workflow * workflo ndpi_packet_tunnel tunnel_type, const struct ndpi_ipv6hdr *iph6, u_int16_t ip_offset, + u_int16_t ipsize, struct ndpi_tcphdr **tcph, struct ndpi_udphdr **udph, u_int16_t *sport, u_int16_t *dport, @@ -923,8 +924,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info6(struct ndpi_workflow * workflo } return(get_ndpi_flow_info(workflow, 6, vlan_id, tunnel_type, - &iph, iph6, ip_offset, - sizeof(struct ndpi_ipv6hdr), + &iph, iph6, ip_offset, ipsize, ntohs(iph6->ip6_hdr.ip6_un1_plen), tcph, udph, sport, dport, src, dst, proto, payload, @@ -1162,7 +1162,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, &payload, &payload_len, &src_to_dst_direction, when); else flow = get_ndpi_flow_info6(workflow, vlan_id, - tunnel_type, iph6, ip_offset, + tunnel_type, iph6, ip_offset, ipsize, &tcph, &udph, &sport, &dport, &src, &dst, &proto, &payload, &payload_len, &src_to_dst_direction, when); -- cgit v1.2.3