Zigbee ZDP dissector field parsing fix

Fixed dissector cannot parse `zbee_zdp.assoc_device_count`
field error. Thanks to Mohammed Suhel mhs@exegin.com for
original implementation.

Change-Id: I3f65aee3d5cc156b8512b3e877746522439b823b
This commit is contained in:
Cole Wu 2024-01-12 20:32:11 -08:00
parent 34c703f7de
commit 0926a98b30
1 changed files with 9 additions and 6 deletions

View File

@ -710,14 +710,15 @@ dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_nwk_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN, &device);
offset += 2;
if (tvb_bytes_exist(tvb, offset, 2*(int)sizeof(guint8))) {
if (tvb_bytes_exist(tvb, offset, 1)) {
/* The presence of these fields depends on the request message. Include them if they exist. */
proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &assoc);
offset += 1;
proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
if ((tree) && (assoc)) {
proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
field_tree = proto_tree_add_subtree(tree, tvb, offset, assoc*(int)sizeof(guint16),
ett_zbee_zdp_assoc_device, NULL, "Associated Device List");
}
@ -727,6 +728,7 @@ dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
}
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
if (status == ZBEE_ZDP_STATUS_SUCCESS) {
zbee_append_info(tree, pinfo, ", Address: %s = 0x%04x", eui64_to_display(pinfo->pool, ext_addr), device);
@ -759,14 +761,15 @@ dissect_zbee_zdp_rsp_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_nwk_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN, &device);
offset += 2;
if (tvb_bytes_exist(tvb, offset, 2*(int)sizeof(guint8))) {
if (tvb_bytes_exist(tvb, offset, 1)) {
/* The presence of these fields depends on the request message. Include them if they exist. */
proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &assoc);
offset += 1;
proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
if ((tree) && (assoc)) {
proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
field_tree = proto_tree_add_subtree(tree, tvb, offset, assoc*(int)sizeof(guint16),
ett_zbee_zdp_assoc_device, NULL, "Associated Device List");
}