aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerasimos Dimitriadis <dimeg@intracom.gr>2010-08-18 21:12:26 +0000
committerGerasimos Dimitriadis <dimeg@intracom.gr>2010-08-18 21:12:26 +0000
commit296be75cb870a8087cb348736f5526852d9c7998 (patch)
tree529746ece1c04ab3d49d8d998855c1d09e4dd1ba /epan
parent323c282897e78fb6be03771108bf753cb4615eff (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 svn path=/trunk/; revision=33842
Diffstat (limited to 'epan')
-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. */