Added check for MAUSB length being multiple of a DWORD.

MAUSB Packets should always be sent in DWORDs. This means that the
only valid values for the length field are multiples of 4.
This patch adds an expert info check to flag length fields that are
multiples of 4.

Change-Id: Ifb793f82aed4c9fb09a12f6ea97087733b58d14a
Reviewed-on: https://code.wireshark.org/review/1536
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Sean O. Stalley 2014-05-06 12:12:09 -07:00 committed by Pascal Quantin
parent d73fc0b294
commit 9a51c1e530
1 changed files with 8 additions and 0 deletions

View File

@ -103,6 +103,7 @@ static int hf_mausb_payload = -1;
/* expert info fields */
static expert_field ei_ep_handle_len = EI_INIT;
static expert_field ei_len = EI_INIT;
static expert_field ei_len_dword = EI_INIT;
static expert_field ei_mgmt_type_undef = EI_INIT;
static expert_field ei_mgmt_type_spec_len_long = EI_INIT;
static expert_field ei_mgmt_type_spec_len_short = EI_INIT;
@ -925,6 +926,9 @@ dissect_mausb_pkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (tvb_reported_length(tvb) != header.length) {
expert_add_info(pinfo, len_field, &ei_len);
}
if (0 != header.length % 4) {
expert_add_info(pinfo, len_field, &ei_len_dword);
}
/* Is the next field a device handle or an endpoint handle */
@ -1391,6 +1395,10 @@ proto_register_mausb(void)
{ "mausb.length", PI_MALFORMED, PI_ERROR,
"Packet length field does not match size of packet", EXPFILL }
},
{ &ei_len_dword,
{ "mausb.length", PI_PROTOCOL, PI_WARN,
"Packet contains partial DWORD", EXPFILL }
},
{ &ei_mgmt_type_undef,
{ "mausb.type", PI_PROTOCOL, PI_WARN,
"Undefined managment packet type", EXPFILL }