OSDN Git Service

gattc: Fix uninitialized memory issue which could lead to crash
authorŁukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Fri, 22 Jan 2021 09:17:53 +0000 (10:17 +0100)
committerJakub Pawlowski <jpawlowski@google.com>
Mon, 25 Jan 2021 15:15:05 +0000 (15:15 +0000)
This is regression after
813bf3ddd gattc: Extend gattc queue with mtu exchange

This patch makes sure that new mtu_cb and mtu_cb_data
are set to 0 when not used.

Tag: #feature
Test: CtsVerifier
Sponsor: jpawlowski@
Fixes: 178129488
Bug: 178129488
Change-Id: Ia550c99ee7292fa275150791fc73e92ae791d91c

bta/gatt/bta_gattc_api.cc

index e31d8af..350dffb 100644 (file)
@@ -203,16 +203,11 @@ void BTA_GATTC_Close(uint16_t conn_id) {
  * Returns          void
  *
  ******************************************************************************/
-void BTA_GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
-  tBTA_GATTC_API_CFG_MTU* p_buf =
-      (tBTA_GATTC_API_CFG_MTU*)osi_malloc(sizeof(tBTA_GATTC_API_CFG_MTU));
-
-  p_buf->hdr.event = BTA_GATTC_API_CFG_MTU_EVT;
-  p_buf->hdr.layer_specific = conn_id;
-  p_buf->mtu = mtu;
 
-  bta_sys_sendmsg(p_buf);
+void BTA_GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
+  BTA_GATTC_ConfigureMTU(conn_id, mtu, NULL, NULL);
 }
+
 void BTA_GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu,
                             GATT_CONFIGURE_MTU_OP_CB callback, void* cb_data) {
   tBTA_GATTC_API_CFG_MTU* p_buf =