aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-nwk.c
diff options
context:
space:
mode:
authordimeg <dimeg@f5534014-38df-0310-8fa8-9805f1628bb7>2010-08-18 21:12:26 +0000
committerdimeg <dimeg@f5534014-38df-0310-8fa8-9805f1628bb7>2010-08-18 21:12:26 +0000
commit7151d2002917424336d158ec39eae3b3af17143b (patch)
tree529746ece1c04ab3d49d8d998855c1d09e4dd1ba /epan/dissectors/packet-zbee-nwk.c
parent9918b0bf4db46429b92d1f61e5c16384ba9b70bd (diff)
Fix for Bug 5052:
Good ZigBee Beacon detected as malformed In ZigBee 2006 the Tx-Offset is optional, while in the 2007 and later versions, the Tx-Offset is a required value. Since both 2006 and and 2007 versions have the same protocol version (2), we should treat the Tx-Offset as well as the update ID as optional elements git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33842 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-zbee-nwk.c')
-rw-r--r--epan/dissectors/packet-zbee-nwk.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index 48af43c2e4..006220a53e 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -1378,19 +1378,24 @@ static void dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
col_append_fstr(pinfo->cinfo, COL_INFO, ", EPID: %s", print_eui64(epid));
}
- /* In ZigBee 2007 and layer, the Tx-Offset is a required value. */
- tx_offset = tvb_get_letoh24(tvb, offset);
- if (tree) {
+ /*
+ * In ZigBee 2006 the Tx-Offset is optional, while in the 2007 and
+ * later versions, the Tx-Offset is a required value. Since both 2006 and
+ * and 2007 versions have the same protocol version (2), we should treat
+ * the Tx-Offset as well as the update ID as optional elements
+ */
+ if (tvb_bytes_exist(tvb, offset, 3)) {
+ tx_offset = tvb_get_letoh24(tvb, offset);
proto_tree_add_uint(beacon_tree, hf_zbee_beacon_tx_offset, tvb, offset, 3, tx_offset);
- }
- offset += 3;
+ offset += 3;
- /* Get and display the update ID. */
- temp = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(beacon_tree, hf_zbee_beacon_update_id, tvb, offset, sizeof(guint8), temp);
+ /* Get and display the update ID. */
+ if(tvb_length_remaining(tvb, offset)) {
+ temp = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint(beacon_tree, hf_zbee_beacon_update_id, tvb, offset, sizeof(guint8), temp);
+ offset += sizeof(guint8);
+ }
}
- offset += sizeof(guint8);
}
else if (tvb_bytes_exist(tvb, offset, 3)) {
/* In ZigBee 2004, the Tx-Offset is an optional value. */