From 54a67a1c457b6c4eb692c43f7ff7a89181b3f93b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 12 Feb 2019 16:38:58 +0200 Subject: [PATCH] shared/gatt-db: Fix crash if next_handle is 0 If the database is reseted all the services shall be ignored and no hash shall be generated. --- src/shared/gatt-db.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index 947627d31..bdce3da47 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -328,6 +328,9 @@ static bool db_hash_update(void *user_data) db->hash_id = 0; + if (!db->next_handle) + return false; + iov = new0(struct iovec, db->next_handle); gatt_db_foreach_service(db, NULL, service_gen_hash_m, iov); -- 2.47.3