aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-zcl.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-27 19:13:57 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-27 19:13:57 +0000
commit2466395f0f0182b113b4aa87ee85e79425c02377 (patch)
tree9e12878fbe0e17106fe58a7c08dda520e7247388 /epan/dissectors/packet-zbee-zcl.c
parent0403469c422485aa11740f19bd609093e93009a8 (diff)
From Fred Fierling:
Fixes bugs in dissection of write attributes, read reporting configuration, and configure reporting clusters in the ZigBee Cluster Library. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4113 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30731 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-zbee-zcl.c')
-rw-r--r--epan/dissectors/packet-zbee-zcl.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index f2f8d8318a..daa07c5f2f 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -785,7 +785,7 @@ static void dissect_zcl_read_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, pr
/* Dissect the status and optionally the data type and value */
if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status)
- == ZBEE_ZCL_STAT_SUCCESS ) {
+ == ZBEE_ZCL_STAT_SUCCESS ) {
/* Dissect the attribute data type and data */
dissect_zcl_attr_data_type_val(tvb, sub_tree, offset);
@@ -869,10 +869,12 @@ static void dissect_zcl_write_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, p
}
/* Dissect the status */
- dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status);
+ if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status) !=
+ ZBEE_ZCL_STAT_SUCCESS ) {
- /* Dissect the attribute identifier */
- dissect_zcl_attr_id(tvb, sub_tree, offset);
+ /* Dissect the failed attribute identifier */
+ dissect_zcl_attr_id(tvb, sub_tree, offset);
+ }
}
return;
@@ -900,6 +902,7 @@ static void dissect_zcl_read_report_config_resp(tvbuff_t *tvb, packet_info *pinf
guint i = 0;
guint data_type;
guint attr_status;
+ guint attr_dir;
tvb_len = tvb_length(tvb);
while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) {
@@ -914,29 +917,33 @@ static void dissect_zcl_read_report_config_resp(tvbuff_t *tvb, packet_info *pinf
attr_status = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status);
/* Dissect the direction and any reported configuration */
- dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir);
+ attr_dir = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir);
/* Dissect the attribute id */
dissect_zcl_attr_id(tvb, sub_tree, offset);
if ( attr_status == ZBEE_ZCL_STAT_SUCCESS ) {
+ if ( attr_dir == ZBEE_ZCL_DIR_REPORTED ) {
- /* Dissect the attribute data type */
- data_type = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_data_type);
+ /* Dissect the attribute data type */
+ data_type = dissect_zcl_attr_uint8(tvb, sub_tree, offset,
+ &hf_zbee_zcl_attr_data_type);
- /* Dissect minimum reporting interval */
- dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_minint);
+ /* Dissect minimum reporting interval */
+ dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_minint);
- /* Dissect maximum reporting interval */
- dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_maxint);
+ /* Dissect maximum reporting interval */
+ dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_maxint);
- if ( IS_ANALOG_SUBTYPE(data_type) ) {
- /* Dissect reportable change */
- dissect_zcl_attr_data(tvb, sub_tree, offset, data_type);
- }
+ if ( IS_ANALOG_SUBTYPE(data_type) ) {
+ /* Dissect reportable change */
+ dissect_zcl_attr_data(tvb, sub_tree, offset, data_type);
+ }
- /* Dissect timeout period */
- dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_timeout);
+ } else {
+ /* Dissect timeout period */
+ dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_timeout);
+ }
}
}
@@ -1041,13 +1048,14 @@ static void dissect_zcl_config_report_resp(tvbuff_t *tvb, packet_info *pinfo _U_
}
/* Dissect the status */
- dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status);
+ if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status) !=
+ ZBEE_ZCL_STAT_SUCCESS ) {
+ /* Dissect the direction on error */
+ dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir);
- /* Dissect the direction */
- dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir);
-
- /* Dissect the attribute identifier */
- dissect_zcl_attr_id(tvb, sub_tree, offset);
+ /* Dissect the attribute identifier on error */
+ dissect_zcl_attr_id(tvb, sub_tree, offset);
+ }
}
return;