summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Sauter <sauter@locoslab.com>2017-06-12 01:22:44 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2017-06-21 11:42:03 +0000
commitc71a7c7f43641362d363d2e88d305a8693f573b2 (patch)
tree057f09f018b001e4fc9435c2ea859ed70d76ff49
parent0ca55e7bce696353ee57f5a06ef3aa243021165c (diff)
downloadwireshark-c71a7c7f43641362d363d2e88d305a8693f573b2.tar.gz
IEEE 802.15.4: Fix double offset increment for Time Correction Header IE
Regression by https://code.wireshark.org/review/21890/ Change-Id: Ieb90672dc2181f5951a8a4165e2676b7882282e5 Reviewed-on: https://code.wireshark.org/review/22087 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> (cherry picked from commit b8e660edc66d7f40545868a377b3385b4c9a54cb) Reviewed-on: https://code.wireshark.org/review/22298
-rw-r--r--epan/dissectors/packet-ieee802154.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 6b4350625a..e3c5f0d9ea 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -278,7 +278,6 @@ static int dissect_ieee802154_payload_mlme_sub_ie(tvbuff_t *tvb, packet_info *p
static int dissect_ieee802154_payload_ie (tvbuff_t *, packet_info *, proto_tree *, int offset);
static int dissect_ieee802154_vendor_ie (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset, gint pie_length);
static void dissect_802154_enhanced_beacon_filter(tvbuff_t *tvb, proto_tree *subtree, guint16 psie_remaining, gint *offset);
-static void dissect_802154_h_ie_time_correction(tvbuff_t *, proto_tree *, guint *, packet_info *pinfo);
static void dissect_802154_tsch_time_sync(tvbuff_t *, proto_tree *, int *, guint);
static void dissect_802154_tsch_timeslot(tvbuff_t *, proto_tree *, guint, guint16, gint*);
static void dissect_802154_tsch_slotframe_link(tvbuff_t *, proto_tree *, guint16, guint16, guint *);
@@ -1943,7 +1942,7 @@ dissect_ieee802154_fcs:
*@param offset offset into the tvbuff to begin dissection.
*/
static void
-dissect_802154_h_ie_time_correction(tvbuff_t *tvb, proto_tree *h_inf_elem_tree, guint *offset, packet_info *pinfo) {
+dissect_802154_h_ie_time_correction(tvbuff_t *tvb, proto_tree *h_inf_elem_tree, guint offset, packet_info *pinfo) {
guint16 raw_data;
proto_tree *time_correction_tree = NULL;
@@ -1952,7 +1951,7 @@ dissect_802154_h_ie_time_correction(tvbuff_t *tvb, proto_tree *h_inf_elem_tree,
proto_item *boolean_item = NULL;
proto_item *drift_item = NULL;
- raw_data = tvb_get_letohs(tvb, *offset);
+ raw_data = tvb_get_letohs(tvb, offset);
is_nack = (gboolean) ((raw_data & (guint16)0x8000) ? 1 : 0);
gint16 drift_us = 0;
@@ -1961,24 +1960,21 @@ dissect_802154_h_ie_time_correction(tvbuff_t *tvb, proto_tree *h_inf_elem_tree,
} else { /* Positive integer */
drift_us = (gint16) (raw_data & 0x0fff);
}
- time_correction_item = proto_tree_add_bytes_format_value(h_inf_elem_tree, hf_ieee802154_time_correction, tvb, *offset, 2, NULL,
+ time_correction_item = proto_tree_add_bytes_format_value(h_inf_elem_tree, hf_ieee802154_time_correction, tvb, offset, 2, NULL,
"Time correction: %d us | Non-acknowledgement: %s", drift_us, (guint32) is_nack ? "True" : "False");
time_correction_tree = proto_item_add_subtree(time_correction_item, ett_ieee802154_h_ie_payload);
/* Valid time correct value */
if(raw_data <= 0x8fff) {
- drift_item = proto_tree_add_int(time_correction_tree, hf_ieee802154_time_correction_value, tvb, *offset, 2, drift_us);
+ drift_item = proto_tree_add_int(time_correction_tree, hf_ieee802154_time_correction_value, tvb, offset, 2, drift_us);
PROTO_ITEM_SET_GENERATED(drift_item);
- boolean_item = proto_tree_add_boolean(time_correction_tree, hf_ieee802154_nack, tvb, *offset, 2, (guint32) is_nack);
+ boolean_item = proto_tree_add_boolean(time_correction_tree, hf_ieee802154_nack, tvb, offset, 2, (guint32) is_nack);
PROTO_ITEM_SET_GENERATED(boolean_item);
}
/* Incorrect value */
else {
expert_add_info(pinfo, time_correction_item, &ei_ieee802154_time_correction_error);
}
-
-
- *offset += 2;
} /* dissect_802154_h_ie_time_correction */
/**
@@ -2483,7 +2479,7 @@ dissect_ieee802154_header_ie(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
case IEEE802154_HEADER_IE_TIME_CORR:
// 7.4.2.7 Time Correction IE
- dissect_802154_h_ie_time_correction(tvb, subtree, offset, pinfo);
+ dissect_802154_h_ie_time_correction(tvb, subtree, *offset, pinfo);
break;
case IEEE802154_HEADER_VENDOR_SPECIFIC: