shared/ad: Fix bt_ad_has_data not matching when only type is passed
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 5 Apr 2023 22:53:12 +0000 (15:53 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 10:41:34 +0000 (16:11 +0530)
bt_ad_has_data attempts to match the data portion even when not set
which is useful the user is only interested in actually mataching the
type alone.

src/shared/ad.c

index caf078c..b2bba95 100755 (executable)
@@ -1022,6 +1022,9 @@ static bool data_match(const void *data, const void *user_data)
        if (d1->type != d2->type)
                return false;
 
+       if (!d2->len && !d2->data)
+               return true;
+
        if (d1->len != d2->len)
                return false;