[PATCH BlueZ v1 6/7] shared/gatt-db: Fix range handling in read by grp type.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes bug in gatt_db_read_by_grp_type in which the range end handle
was being ignored. This caused incorrect results to be sent for a database
where services exists beyond the end handle provided in the request.
---
 src/shared/gatt-db.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index b3f95d2..65c5759 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -428,6 +428,7 @@ static void read_by_group_type(void *data, void *user_data)
 {
 	struct read_by_group_type_data *search_data = user_data;
 	struct gatt_db_service *service = data;
+	uint16_t grp_start, grp_end;
 
 	if (!service->active)
 		return;
@@ -439,7 +440,15 @@ static void read_by_group_type(void *data, void *user_data)
 	if (bt_uuid_cmp(&search_data->uuid, &service->attributes[0]->uuid))
 		return;
 
-	if (service->attributes[0]->handle < search_data->start_handle)
+	grp_start = service->attributes[0]->handle;
+	grp_end = grp_start + service->num_handles - 1;
+
+	if (grp_end < search_data->start_handle ||
+				grp_start > search_data->end_handle)
+		return;
+
+	if (service->attributes[0]->handle < search_data->start_handle ||
+		service->attributes[0]->handle > search_data->end_handle)
 		return;
 
 	/* Remember size of uuid */
-- 
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux