]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Walk over DHCPv4 padding option rather than returning NULL
authorNick Porter <nick@portercomputing.co.uk>
Tue, 17 Jun 2025 09:22:02 +0000 (10:22 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 17 Jun 2025 09:22:02 +0000 (10:22 +0100)
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

index c17c3ec21b5d95428725eb0fffda9d54fc668221..6d0d0d6390b915f9278e466231c4d48fa10cc6ed 100644 (file)
@@ -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)) {