From f17f1277607e5d745d889489f8da43b2a4e996a6 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Sat, 30 Nov 2019 23:04:57 +0100 Subject: [PATCH] ieee1722: use payload_length only when it's valid. Bug: 16241 Change-Id: If9e08fef649830dfed48a53d2d1cad983b7ca090 Reviewed-on: https://code.wireshark.org/review/35263 Petri-Dish: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ieee1722.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c index 3cb4fa74e0..ec6a3110bb 100644 --- a/epan/dissectors/packet-ieee1722.c +++ b/epan/dissectors/packet-ieee1722.c @@ -2832,16 +2832,17 @@ static int dissect_1722_acf_lin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t col_add_fstr(pinfo->cinfo, COL_INFO, "ACF-LIN(%u): 0x%02x ", bus_id, lin_id); payload_length = tvb_reported_length_remaining(tvb, offset) - pad_length; - col_append_str(pinfo->cinfo, COL_INFO, tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, offset, payload_length, ' ')); if (payload_length < 0 || payload_length > 8) { expert_add_info(pinfo, ti_lin, &ei_1722_lin_invalid_payload_length); - } else if (payload_length > 0) { tvbuff_t* next_tvb = tvb_new_subset_length(tvb, offset, payload_length); + + col_append_str(pinfo->cinfo, COL_INFO, tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, offset, payload_length, ' ')); + /* at the moment, there's no global LIN sub-protocols support. Use our own. */ if (dissector_try_payload_new(avb1722_acf_lin_dissector_table, next_tvb, pinfo, tree, TRUE, &lin_id) <= 0) {