diff options
author | Luca Deri <deri@ntop.org> | 2025-01-08 08:30:31 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2025-01-08 08:30:31 +0100 |
commit | f129005c1b4a63c81a6d89c1572f35ecc14306a3 (patch) | |
tree | b79d15b7cb12bcfed5f6fd488e66d4863d70f7d0 | |
parent | 47569042224bc277454ba138d1033d8b334e6be8 (diff) |
Added ICMP risk checks for valid packet payloads
-rw-r--r-- | src/lib/ndpi_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index c8f483da9..97df06ed9 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -4439,7 +4439,7 @@ static u_int16_t guess_protocol_id(struct ndpi_detection_module_struct *ndpi_str case NDPI_PIM_PROTOCOL_TYPE: return(NDPI_PROTOCOL_IP_PIM); case NDPI_ICMP_PROTOCOL_TYPE: - if(flow) { + if(flow && (packet->payload_packet_len > 0)) { flow->entropy = 0.0f; /* Run some basic consistency tests */ @@ -4491,7 +4491,7 @@ static u_int16_t guess_protocol_id(struct ndpi_detection_module_struct *ndpi_str case NDPI_IPIP_PROTOCOL_TYPE: return(NDPI_PROTOCOL_IP_IP_IN_IP); case NDPI_ICMPV6_PROTOCOL_TYPE: - if(flow) { + if(flow && (packet->payload_packet_len > 0 /* is 0 when guessing */)) { /* Run some basic consistency tests */ if(packet->payload_packet_len < sizeof(struct ndpi_icmp6hdr)) { |