Skip to content

Commit

Permalink
Added ICMP risk checks for valid packet payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Jan 8, 2025
1 parent 4756904 commit f129005
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit f129005

Please sign in to comment.