Fix size mismatch issue on get_cluster_list method
authorJiwan Kim <ji-wan.kim@samsung.com>
Thu, 9 Feb 2017 07:55:56 +0000 (16:55 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:10:26 +0000 (18:10 +0900)
Change-Id: I94e7729b94849d11b6033c3ced48de448866c538
Signed-off-by: Jiwan Kim <ji-wan.kim@samsung.com>
common/include/zigbee_service_type.h
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c

index 4dd3af4..6ca4585 100644 (file)
@@ -160,8 +160,8 @@ typedef struct {
        int result; /**< Result */
        int in_cluster_count; /**< The number of in clusters */
        int out_cluster_count; /**< The number of out clusters */
-       unsigned char in_clusters[ZIGBEE_MAX_CLUSTERS]; /**< In Clusters */
-       unsigned char out_clusters[ZIGBEE_MAX_CLUSTERS]; /**< Out Clusters */
+       unsigned short in_clusters[ZIGBEE_MAX_CLUSTERS]; /**< In Clusters */
+       unsigned short out_clusters[ZIGBEE_MAX_CLUSTERS]; /**< Out Clusters */
 } ZigbeeServiceGetClusterListResp_t;
 
 /**
index cf97c6e..544cd83 100644 (file)
@@ -1203,9 +1203,11 @@ static void on_service_get_cluster_list_resp(ZigBeeServiceInterface *service_int
        zblib_check_null_free_and_ret("invocation", invocation, cb_data);
 
        v_in_clusters = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
-               payload->in_clusters, payload->in_cluster_count, TRUE, NULL, NULL);
+               payload->in_clusters, (payload->in_cluster_count * sizeof(unsigned short)),
+               TRUE, NULL, NULL);
        v_out_clusters = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
-               payload->out_clusters, payload->out_cluster_count, TRUE, NULL, NULL);
+               payload->out_clusters, (payload->out_cluster_count * sizeof(unsigned short)),
+               TRUE, NULL, NULL);
 
        zigbee_service_complete_get_cluster_list(service_object, invocation,
                payload->result, v_in_clusters, v_out_clusters);