[PATCH BlueZ 2/2] shared/gatt-db: Prevent insert at invalid handle 0

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

 



Handles can't be placed at 0x0000.
---
 src/shared/gatt-db.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 2a35bae..2a0fcb1 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -376,7 +376,8 @@ struct gatt_db_attribute *gatt_db_insert_service(struct gatt_db *db,
 	struct insert_loc_data data;
 	struct gatt_db_service *service;
 
-	if (!db || num_handles < 1 || (handle + num_handles - 1) > UINT16_MAX)
+	if (!db || num_handles < 1 || handle < 1 ||
+					(handle + num_handles - 1) > UINT16_MAX)
 		return NULL;
 
 	memset(&data, 0, sizeof(data));
-- 
2.2.0.rc0.207.ga3a616c

--
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