Skip to content

Commit

Permalink
dhcp: fix out of bounds acces
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanNardi committed Sep 16, 2024
1 parent f310424 commit 3b8e768
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/protocols/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struc
u_int8_t len = ndpi_min(dhcp->options[i+1] /* len as found in the packet */,
dhcp_options_size - (i+2) /* 1 for the type and 1 for the value */);

if(len == 0)
if(len == 0 || opt_offset >= sizeof(flow->protos.dhcp.options))
break;

rc = ndpi_snprintf((char*)&flow->protos.dhcp.options[opt_offset],
Expand Down

0 comments on commit 3b8e768

Please sign in to comment.