dissector/mqtt: DISCONNECT and AUTH may not include the Property field

From the spec:

3.14.2.2.1 Property Length: The length of Properties in the DISCONNECT
packet Variable Header encoded as a Variable Byte Integer. If the
Remaining Length is less than 2, a value of 0 is used

In this commit we also assume that AUTH may not include the Property
field, given that DISCONNECT and AUTH share the same structure.

Change-Id: I5f55151df6b2066d924b2c16fb08a63b0903ef46
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24288
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Flavio Santes 2017-11-07 16:53:45 -05:00 committed by Stig Bjørlykke
parent 76eab87c7d
commit bf8d8ebfa4
1 changed files with 9 additions and 1 deletions

View File

@ -853,7 +853,15 @@ static int dissect_mqtt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
proto_tree_add_item(mqtt_tree, hf_mqtt_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
offset += dissect_mqtt_properties(tvb, mqtt_tree, offset);
/* 3.14.2.2 DISCONNECT Properties:
* If the Remaining Length is less than 2, a value of 0 is used.
* Let's assume that it also applies to AUTH, why? DISCONNECT and AUTH
* share the same structure with no payload.
*/
if (mqtt_msg_len >= 2)
{
offset += dissect_mqtt_properties(tvb, mqtt_tree, offset);
}
}
break;