Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76c3ace8 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

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
parent e2597adb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);