]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Emit a FR_PROTO_HEX_DUMP message about trailing junk
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 28 Nov 2016 20:01:25 +0000 (15:01 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 28 Nov 2016 20:05:05 +0000 (15:05 -0500)
src/modules/proto_dhcp/dhcp.c

index 432c763d137811470ebcb285cece2d49048d1348..d87af629b1187397f41f616b683020c323be5a12 100644 (file)
@@ -1067,6 +1067,14 @@ ssize_t fr_dhcp_decode_option(TALLOC_CTX *ctx, vp_cursor_t *cursor,
         */
        if (p[0] == 0) return 1;                /* 0x00 - Padding option */
        if (p[0] == 255) {                      /* 0xff - End of options signifier */
+               size_t i;
+
+               for (i = 1; i < data_len; i++) {
+                       if (p[i] != 0) {
+                               FR_PROTO_HEX_DUMP("ignoring trailing junk at end of packet", p + i, data_len - i);
+                               break;
+                       }
+               }
                return data_len;
        }