From 3161c8a3de52d6ec273a59324e994bcbaef569de Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Mon, 16 Sep 2024 16:22:50 +0200 Subject: dhcp: fix out of bounds acces --- src/lib/protocols/dhcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/protocols/dhcp.c b/src/lib/protocols/dhcp.c index 564e5e243..4c400df9a 100644 --- a/src/lib/protocols/dhcp.c +++ b/src/lib/protocols/dhcp.c @@ -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], -- cgit v1.2.3