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

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

LE: Only copy UUID for callback on success

When a GATT client application registers with the stack, the UUID is
always copied into the callback buffer, even if the registration failed.
This patch adds a check to make sure an invalid UUID is not passed back
to the application.

Change-Id: I53ddc7939c096a33a64b00a8902bedba00b61e7d
parent 43ca2f0a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -117,9 +117,6 @@ void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data)

                /* BTA use the same client interface as BTE GATT statck */
                cb_data.reg_oper.client_if = p_cb->cl_rcb[i].client_if;
// btla-specific ++
                memcpy(&(cb_data.reg_oper.app_uuid),p_app_uuid,sizeof(tBT_UUID));
// btla-specific --

                if ((p_buf = (tBTA_GATTC_INT_START_IF *) GKI_getbuf(sizeof(tBTA_GATTC_INT_START_IF))) != NULL)
                {
@@ -141,6 +138,9 @@ void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data)
    /* callback with register event */
    if (p_data->api_reg.p_cback)
    {
        if (p_app_uuid != NULL)
            memcpy(&(cb_data.reg_oper.app_uuid),p_app_uuid,sizeof(tBT_UUID));

        cb_data.reg_oper.status = status;
        (*p_data->api_reg.p_cback)(BTA_GATTC_REG_EVT,  (tBTA_GATTC *)&cb_data);
    }