Skip to content

Commit 42ddce4

Browse files
committed
fix(bt/bluedroid): Fix some bugs in PBAP client
- Supported feature not set correctly - Array access out of bounds issue - Type conversion warning
1 parent 265e73d commit 42ddce4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

components/bt/host/bluedroid/bta/pba/bta_pba_client_act.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,22 +334,22 @@ static void goep_event_callback(UINT16 handle, UINT8 event, tGOEPC_MSG *p_msg)
334334
switch (event)
335335
{
336336
case GOEPC_OPENED_EVT:
337-
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_GOEP_CONNECT));
337+
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_DATA));
338338
assert(p_data != NULL);
339339
p_data->goep_connect.hdr.event = BTA_PBA_CLIENT_GOEP_CONNECT_EVT;
340340
p_data->goep_connect.hdr.layer_specific = handle;
341341
p_data->goep_connect.our_mtu = p_msg->opened.our_mtu;
342342
p_data->goep_connect.peer_mtu = p_msg->opened.peer_mtu;
343343
break;
344344
case GOEPC_CLOSED_EVT:
345-
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_GOEP_DISCONNECT));
345+
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_DATA));
346346
assert(p_data != NULL);
347347
p_data->goep_disconnect.hdr.event = BTA_PBA_CLIENT_GOEP_DISCONNECT_EVT;
348348
p_data->goep_disconnect.hdr.layer_specific = handle;
349349
p_data->goep_disconnect.reason = p_msg->closed.reason;
350350
break;
351351
case GOEPC_RESPONSE_EVT:
352-
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_GOEP_RESPONSE));
352+
p_data = (tBTA_PBA_CLIENT_DATA *)osi_malloc(sizeof(tBTA_PBA_CLIENT_DATA));
353353
assert(p_data != NULL);
354354
p_data->goep_response.hdr.layer_specific = handle;
355355
p_data->goep_response.pkt = p_msg->response.pkt;

components/bt/host/bluedroid/bta/pba/bta_pba_client_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ void BTA_PbaClientOpen(BD_ADDR bd_addr, tBTA_SEC sec_mask, UINT32 supported_feat
8080
if ((p_buf = (tBTA_PBA_CLIENT_API_OPEN *)osi_malloc(sizeof(tBTA_PBA_CLIENT_API_OPEN))) != NULL) {
8181
p_buf->hdr.event = BTA_PBA_CLIENT_API_OPEN_EVT;
8282
p_buf->sec_mask = sec_mask;
83+
p_buf->supported_feat = supported_feat;
8384
p_buf->mtu = mtu;
8485
bdcpy(p_buf->bd_addr, bd_addr);
8586
bta_sys_sendmsg(p_buf);

components/bt/host/bluedroid/bta/pba/bta_pba_client_sdp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ BOOLEAN bta_pba_client_do_disc(tBTA_PBA_CLIENT_CCB *p_ccb)
214214
{
215215
tSDP_UUID uuid_list[1];
216216
UINT16 num_uuid = 1;
217-
UINT16 attr_list[4];
218-
UINT8 num_attr;
217+
UINT16 attr_list[6];
218+
UINT8 num_attr = 6;
219219
BOOLEAN db_inited = FALSE;
220220

221221
/* get proto list and features */
@@ -225,7 +225,6 @@ BOOLEAN bta_pba_client_do_disc(tBTA_PBA_CLIENT_CCB *p_ccb)
225225
attr_list[3] = ATTR_ID_GOEP_L2CAP_PSM;
226226
attr_list[4] = ATTR_ID_SUPPORTED_REPOSITORIES;
227227
attr_list[5] = ATTR_ID_PBAP_SUPPORTED_FEATURES;
228-
num_attr = 6;
229228
uuid_list[0].uu.uuid16 = UUID_SERVCLASS_PBAP_PSE;
230229
uuid_list[0].len = LEN_UUID_16;
231230

0 commit comments

Comments
 (0)