diff options
author | Guy Harris <gharris@sonic.net> | 2023-04-10 23:36:21 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2023-04-10 23:36:21 -0700 |
commit | cebc5988bdde08a21714f66479bf9a6a5150d2da (patch) | |
tree | 5e2db5ccfc833f674f55ca1d2eadeea21dad69aa | |
parent | c845af56663580bd38ace3dedfd83f0a9e7cbcb4 (diff) | |
download | tcpdump-cebc5988bdde08a21714f66479bf9a6a5150d2da.tar.gz |
cdp: require that the Address TLV have at least 4 bytes of data.
Specify a minimum length of 4 in the cdptlvs table, rather than having
its printer do the length check itself.
-rw-r--r-- | print-cdp.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/print-cdp.c b/print-cdp.c index 62eeed45..0e88929b 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -213,7 +213,7 @@ struct cdp_tlvinfo { static const struct cdp_tlvinfo cdptlvs[] = { /* 0x00 */ [ 0x01 ] = { "Device-ID", cdp_print_string, VERBOSE_OR_NOT_VERBOSE, -1, -1 }, - [ 0x02 ] = { "Address", cdp_print_addr, VERBOSE_ONLY, -1, -1 }, + [ 0x02 ] = { "Address", cdp_print_addr, VERBOSE_ONLY, 4, -1 }, [ 0x03 ] = { "Port-ID", cdp_print_string, VERBOSE_ONLY, -1, -1 }, [ 0x04 ] = { "Capability", cdp_print_capability, VERBOSE_ONLY, 4, 4 }, [ 0x05 ] = { "Version String", cdp_print_version, VERBOSE_ONLY, -1, -1 }, @@ -375,10 +375,6 @@ cdp_print_addr(netdissect_options *ndo, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd }; - if (l < 4) { - ND_PRINT(" (not enough space for num)"); - goto invalid; - } num = GET_BE_U_4(p); p += 4; l -= 4; |