shared/gatt-db: Fix crash when generating hash
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 14 May 2019 07:39:27 +0000 (10:39 +0300)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
commit3304f46f1a6a1cb3d6d07468f8d15583d3d265b2
tree7510e5d93b4e6ad5f304f306ce140b430c3f6881
parent4b3b656b959c52fb75e2f68cc88047b95851060e
shared/gatt-db: Fix crash when generating hash

The following crash can be observed when handles are not contiguous:

Invalid write of size 8
   at 0x452697: gen_hash_m (gatt-db.c:314)
   by 0x453FE8: gatt_db_service_foreach (gatt-db.c:1395)
   by 0x45408C: service_gen_hash_m (gatt-db.c:322)
   by 0x4548F1: foreach_service_in_range (gatt-db.c:1284)
   by 0x4548F1: foreach_in_range (gatt-db.c:1307)
   by 0x457470: queue_foreach (queue.c:220)
   by 0x453B75: gatt_db_foreach_service_in_range (gatt-db.c:1349)
   by 0x453BAC: gatt_db_foreach_service (gatt-db.c:1254)
   by 0x453C46: db_hash_update (gatt-db.c:340)
   by 0x4567B4: timeout_callback (timeout-glib.c:34)

Change-Id: Idc0456441e2b94935e7475e25b62428277180797
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/shared/gatt-db.c