diff options
author | Yasuyuki Tanaka <yatch@isl.rdc.toshiba.co.jp> | 2016-10-28 21:07:48 +0200 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-10-29 10:51:22 +0000 |
commit | 23b79f9304e020fa96de699f4fcaa11044df08b7 (patch) | |
tree | 3ceab4b669a8562f28820796c5d6e1e282ee917f | |
parent | 0420dc1e7ba08e32ef2f80bd890af5e51bb199e7 (diff) |
ieee802154: avoid extra dissection on Payload IEs & Cmd ID
Bug:13068
Change-Id: I4db500030ac2608e57bab4281f44576de9792076
Reviewed-on: https://code.wireshark.org/review/18558
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index 2566c8fd6d..e7ec46bcec 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -1522,15 +1522,16 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g } /* presense of Payload IEs is defined by the termination of the Header IEs */ + offset = 0; if (packet->payload_ie_present) { - offset += dissect_ieee802154_payload_ie(tvb, pinfo, ieee802154_tree, offset); + offset += dissect_ieee802154_payload_ie(payload_tvb, pinfo, ieee802154_tree, offset); } if ((packet->version == IEEE802154_VERSION_2015) && (packet->frame_type == IEEE802154_FCF_CMD)) { /* In 802.15.4e and later the Command Id follows the Payload IEs. */ - packet->command_id = tvb_get_guint8(tvb, offset); + packet->command_id = tvb_get_guint8(payload_tvb, offset); if (tree) { - proto_tree_add_uint(ieee802154_tree, hf_ieee802154_cmd_id, tvb, offset, 1, packet->command_id); + proto_tree_add_uint(ieee802154_tree, hf_ieee802154_cmd_id, payload_tvb, offset, 1, packet->command_id); } offset++; @@ -1543,12 +1544,17 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g } } + if (offset > 0) { + payload_tvb = tvb_new_subset_remaining(payload_tvb, offset); + offset = 0; + } + /* If it is ok to dissect bad FCS, FCS might be absent, so still dissect * commands like Association request. */ if ((!ieee802154_fcs_ok /* If either ZBOSS traffic dump or TI CC2{45}xx, FCS must be present. */ && !(options & (DISSECT_IEEE802154_OPTION_ZBOSS | DISSECT_IEEE802154_OPTION_CC24xx))) - || tvb_captured_length_remaining(tvb, offset) > IEEE802154_FCS_LEN) { + || tvb_captured_length(payload_tvb) > 0) { /* * Wrap the sub-dissection in a try/catch block in case the payload is * broken. First we store the current protocol so we can fix it if an |