Diff between 5ed65041be73a8ccfd8aeb9902a18c2e3d982282 and 2af5da498dfa69f05943f0cb49965e7ca33eaffc

Changed Files

File Additions Deletions Status
src/shared/gatt-db.c +4 -1 modified

Full Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index b210376..083045f 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -405,7 +405,10 @@ 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 || handle < 1)
+		return NULL;
+
+	if (num_handles < 1 || (handle + num_handles - 1) > UINT16_MAX)
 		return NULL;
 
 	memset(&data, 0, sizeof(data));