Fix le advertising service data parsing logic 66/243766/1 accepted/tizen/unified/20200910.123916 submit/tizen/20200910.053710
authorWootak Jung <wootak.jung@samsung.com>
Thu, 10 Sep 2020 02:11:46 +0000 (11:11 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 10 Sep 2020 02:11:46 +0000 (11:11 +0900)
Change-Id: I02a964819ebf1e51a39f9f78cf55c30fda5bc700
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/bluetooth-adapter.c

index e445a89..d4c22e6 100644 (file)
@@ -2256,7 +2256,6 @@ static int __bt_find_uuid_in_service_data(bt_advertiser_h advertiser,
        char *adv_data = NULL;
        int adv_len = 0;
        bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser;
-       bt_adapter_le_advertising_data_type_e data_type = BT_ADAPTER_LE_ADVERTISING_DATA_SERVICE_DATA;
 
        if (pkt_type == BT_ADAPTER_LE_PACKET_ADVERTISING) {
 
@@ -2265,8 +2264,10 @@ static int __bt_find_uuid_in_service_data(bt_advertiser_h advertiser,
        } else if (pkt_type == BT_ADAPTER_LE_PACKET_SCAN_RESPONSE) {
                adv_data = __adv->scan_rsp_data;
                adv_len = __adv->scan_rsp_data_len;
-       } else
+       } else {
+               BT_ERR("Invalid Pakcet Type");
                return BT_ERROR_INVALID_PARAMETER;
+       }
 
        if (!adv_data) {
                BT_INFO("Currently there is no advertisement data");
@@ -2278,7 +2279,7 @@ static int __bt_find_uuid_in_service_data(bt_advertiser_h advertiser,
                len = adv_data[i];
                type = adv_data[i + 1];
 
-               if (type == data_type) {
+               if (type == BT_ADAPTER_LE_ADVERTISING_DATA_SERVICE_DATA) {
                        if (!memcmp((adv_data + i + 2), uuid, 2)) {
                                BT_INFO("uuid matched");
                                *exist = true;
@@ -2286,7 +2287,7 @@ static int __bt_find_uuid_in_service_data(bt_advertiser_h advertiser,
                        }
                }
 
-               i = len  + 1;
+               i += (len + 1);
        }
 
        *exist = false;