summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Eisenbach <andre@broadcom.com>2013-05-29 10:21:39 -0700
committerMatthew Xie <mattx@google.com>2013-08-14 00:39:33 +0000
commitf052217962d0c06392eb79687820c9469cd6a75a (patch)
tree3200c88250af5698837be8afff159b892b4f10cd
parentdda9a3e71119078181638cf3f5a51e38d173f6d4 (diff)
downloadandroid_system_bt-f052217962d0c06392eb79687820c9469cd6a75a.tar.gz
android_system_bt-f052217962d0c06392eb79687820c9469cd6a75a.tar.bz2
android_system_bt-f052217962d0c06392eb79687820c9469cd6a75a.zip
LE: Fix GKI exception for 0 length values
When a remote device responds to a read request with a 0 length value, a GKI exception will occur. This patch checks for 0 length values to avoid the exception and return the correct status to the application requesting the read. Change-Id: Idce61c3d2be7072dafe429ab978763b0ee61aed2
-rw-r--r--btif/src/btif_gatt_client.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/btif/src/btif_gatt_client.c b/btif/src/btif_gatt_client.c
index 3b57b5049..f611c40db 100644
--- a/btif/src/btif_gatt_client.c
+++ b/btif/src/btif_gatt_client.c
@@ -174,6 +174,7 @@ static void btapp_gattc_req_data(UINT16 event, char *p_dest, char *p_src)
// Allocate buffer for att value if necessary
if (get_uuid16(&p_src_data->read.descr_type) != GATT_UUID_CHAR_AGG_FORMAT
+ && p_src_data->read.p_value->unformat.len > 0
&& p_src_data->read.p_value->unformat.p_value != NULL)
{
p_dest_data->read.p_value->unformat.p_value =
@@ -210,6 +211,7 @@ static void btapp_gattc_free_req_data(UINT16 event, tBTA_GATTC *p_data)
if (p_data != NULL && p_data->read.p_value != NULL)
{
if (get_uuid16 (&p_data->read.descr_type) != GATT_UUID_CHAR_AGG_FORMAT
+ && p_data->read.p_value->unformat.len > 0
&& p_data->read.p_value->unformat.p_value != NULL)
{
GKI_freebuf(p_data->read.p_value->unformat.p_value);