summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-cdp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c
index 9cd59d06cb..460d623bd1 100644
--- a/epan/dissectors/packet-cdp.c
+++ b/epan/dissectors/packet-cdp.c
@@ -378,7 +378,8 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
case TYPE_PORT_ID:
real_length = length;
- if (tvb_get_guint8(tvb, offset + real_length) != 0x00) {
+ if ((tvb_reported_length_remaining(tvb, offset) >= length + 3) &&
+ (tvb_get_guint8(tvb, offset + real_length) != 0x00)) {
/* 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