From 681a5c95ebafb2551361f675a1605b657a183a76 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski <jpawlowski@google.com> Date: Wed, 18 Jan 2017 22:58:53 -0800 Subject: [PATCH] Fix bad UUID comparison when adding GATT service This patch fixes bad comparison in add_service_impl. Instead of checking wether service is one of two excluded services, it was excluding all services. Test: sl4a GatReadTest Bug: 34280184 Change-Id: I3195e94b6fafe4d2e3c61fc7bfd7398c2855b78e --- system/btif/src/btif_gatt_server.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/btif/src/btif_gatt_server.cc b/system/btif/src/btif_gatt_server.cc index e5f4e0f51d3..702e2b36fb9 100644 --- a/system/btif/src/btif_gatt_server.cc +++ b/system/btif/src/btif_gatt_server.cc @@ -366,8 +366,8 @@ static void add_service_impl(int server_if, // TODO(jpawlowski): btif should be a pass through layer, and no checks should // be made here. This exception is added only until GATT server code is // refactored, and one can distinguish stack-internal aps from external apps - if (memcmp(&service[0].uuid, &restricted_uuid1, sizeof(bt_uuid_t)) || - memcmp(&service[0].uuid, &restricted_uuid2, sizeof(bt_uuid_t))) { + if (memcmp(&service[0].uuid, &restricted_uuid1, sizeof(bt_uuid_t)) == 0 || + memcmp(&service[0].uuid, &restricted_uuid2, sizeof(bt_uuid_t)) == 0) { LOG_ERROR(LOG_TAG, "%s: Attept to register restricted service", __func__); HAL_CBACK(bt_gatt_callbacks, server->service_added_cb, BT_STATUS_FAIL, server_if, std::move(service)); -- GitLab