From: Nitin Arora Date: Thu, 14 Jul 2016 01:02:03 +0000 (-0700) Subject: Bluetooth: Prevent gatt DB copy if server cache is absent X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f8f5c9437dbf2d73078ea6ed293bd486ecfe3cd4;p=android-x86%2Fsystem-bt.git Bluetooth: Prevent gatt DB copy if server cache is absent In case the server cache does not exist for a specific connection, the API used to copy the server DB into the DB structure needs to return immediately. This change makes sure of that and prevents dereferencing of a null block causing the runtime error. Change-Id: Iec3040a1280ef9d80b1b9c76eca8071dff499411 CRs-Fixed: 1040951 --- diff --git a/bta/gatt/bta_gattc_cache.c b/bta/gatt/bta_gattc_cache.c index 5050ea968..25d20b67d 100644 --- a/bta/gatt/bta_gattc_cache.c +++ b/bta/gatt/bta_gattc_cache.c @@ -1327,6 +1327,7 @@ void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handl if (!p_clcb->p_srcb || p_clcb->p_srcb->p_srvc_list || /* no active discovery */ !p_clcb->p_srcb->p_srvc_cache) { APPL_TRACE_ERROR("No server cache available"); + return; } bta_gattc_get_gatt_db_impl(p_clcb->p_srcb, start_handle, end_handle, db, count);