CDP: Improve CDP port ID TLV hack heuristic

The heuristic used for dissection of the port ID TLV breaks in the face
of subsequent TLVs with tags starting with 0x10xx. This change fixes the
heuristic to allow these new TLVs to follow the port ID TLV without
triggering the workaround for buggy CDP senders.

Bug: 16742
Change-Id: I40c7ce790263c6de9b59ce543485cf3827f77fe7
Reviewed-on: https://code.wireshark.org/review/37985
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Jaap Keuter 2020-07-29 14:44:55 +02:00 committed by Alexis La Goutte
parent c68d36b173
commit 28bec58f05
1 changed files with 2 additions and 1 deletions

View File

@ -377,7 +377,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
case TYPE_PORT_ID:
real_length = length;
if ((tvb_reported_length_remaining(tvb, offset) >= length + 3) &&
(tvb_get_guint8(tvb, offset + real_length) != 0x00)) {
(tvb_get_guint8(tvb, offset + real_length) != 0x00) &&
(tvb_get_guint8(tvb, offset + real_length) != 0x10)) {
/* The length in the TLV doesn't appear to be the
length of the TLV, as the byte just past it
isn't the first byte of a 2-byte big-endian