From b3f996f0e1d6026e4751e11b382ebc309d648be0 Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Tue, 17 Jun 2025 10:22:02 +0100 Subject: [PATCH] Walk over DHCPv4 padding option rather than returning NULL Some clients put padding in the middle of packets - so the option we're looking for may be after the padding. --- src/protocols/dhcpv4/packet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/protocols/dhcpv4/packet.c b/src/protocols/dhcpv4/packet.c index c17c3ec21b..6d0d0d6390 100644 --- a/src/protocols/dhcpv4/packet.c +++ b/src/protocols/dhcpv4/packet.c @@ -48,7 +48,11 @@ uint8_t const *fr_dhcpv4_packet_get_option(dhcp_packet_t const *packet, size_t p data = &packet->options[where]; while (where < size) { - if (data[0] == 0) return NULL; /* padding */ + if (data[0] == 0) { /* padding */ + where++; + data++; + continue; + } if (data[0] == 255) { /* end of options */ if ((field == DHCP_OPTION_FIELD) && (overload & DHCP_FILE_FIELD)) { -- 2.47.3