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 <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dario Lombardo 2019-11-30 23:04:57 +01:00 committed by Michael Mann
parent d4ca6cc550
commit f17f127760
1 changed files with 3 additions and 2 deletions

View File

@ -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)
{