OSDN Git Service

Bluetooth: Prevent gatt DB copy if server cache is absent
authorNitin Arora <niarora@codeaurora.org>
Thu, 14 Jul 2016 01:02:03 +0000 (18:02 -0700)
committerLinux Build Service Account <lnxbuild@localhost>
Wed, 24 Aug 2016 14:09:57 +0000 (08:09 -0600)
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

bta/gatt/bta_gattc_cache.c

index 5050ea9..25d20b6 100644 (file)
@@ -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);