mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(bt/bluedroid): fixed multiple high-severity issues from AI code review in Bluedroid
This commit is contained in:
@@ -185,7 +185,7 @@ static void l2c_ucd_config_cfm_cback (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
|
||||
**
|
||||
** Parameters: tL2CAP_UCD_CB_INFO
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info )
|
||||
@@ -242,12 +242,12 @@ BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info )
|
||||
**
|
||||
** Parameters: PSM
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN L2CA_UcdDeregister_In_CCB_List (void *p_ccb_node, void * context)
|
||||
{
|
||||
p_ccb = (tL2C_CCB *)p_ccb_node;
|
||||
tL2C_CCB *p_ccb = (tL2C_CCB *)p_ccb_node;
|
||||
if (( p_ccb->in_use )
|
||||
&& ( p_ccb->local_cid == L2CAP_CONNECTIONLESS_CID )) {
|
||||
l2cu_release_ccb (p_ccb);
|
||||
@@ -301,7 +301,7 @@ BOOLEAN L2CA_UcdDeregister ( UINT16 psm )
|
||||
** L2CAP_UCD_INFO_TYPE_MTU
|
||||
**
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type )
|
||||
@@ -450,7 +450,7 @@ UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 fla
|
||||
** Parameters: BD Addr
|
||||
** Timeout in second
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout )
|
||||
@@ -517,7 +517,7 @@ BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority )
|
||||
**
|
||||
** Parameters: BD_ADDR of remote device
|
||||
**
|
||||
** Return value: TRUE if successs
|
||||
** Return value: TRUE if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda )
|
||||
@@ -597,7 +597,7 @@ static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda )
|
||||
void l2c_ucd_delete_sec_pending_q(tL2C_LCB *p_lcb)
|
||||
{
|
||||
/* clean up any security pending UCD */
|
||||
while (p_lcb->ucd_out_sec_pending_q.p_first) {
|
||||
while (!fixed_queue_is_empty(p_lcb->ucd_out_sec_pending_q)) {
|
||||
osi_free(fixed_queue_dequeue(p_lcb->ucd_out_sec_pending_q, 0));
|
||||
}
|
||||
fixed_queue_free(p_lcb->ucd_out_sec_pending_q, NULL);
|
||||
@@ -606,7 +606,7 @@ void l2c_ucd_delete_sec_pending_q(tL2C_LCB *p_lcb)
|
||||
while (! fixed_queue_is_empty(p_lcb->ucd_in_sec_pending_q)) {
|
||||
osi_free(fixed_queue_dequeue(p_lcb->ucd_in_sec_pending_q, 0));
|
||||
}
|
||||
fixed_queue_free(p_lcb->ucd_in_sec_pending_q);
|
||||
fixed_queue_free(p_lcb->ucd_in_sec_pending_q, NULL);
|
||||
p_lcb->ucd_in_sec_pending_q = NULL;
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB *p_ccb)
|
||||
*******************************************************************************/
|
||||
void l2c_ucd_send_pending_in_sec_q(tL2C_CCB *p_ccb)
|
||||
{
|
||||
BT_HDR *p_buf = (BT_HDR*)fixed_queue_dequeue(p_ccb->p_lcb->ucd_in_sec_pending_q, 0)
|
||||
BT_HDR *p_buf = (BT_HDR*)fixed_queue_dequeue(p_ccb->p_lcb->ucd_in_sec_pending_q, 0);
|
||||
|
||||
if (p_buf != NULL) {
|
||||
p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Data_Cb(p_ccb->p_lcb->remote_bd_addr, (BT_HDR *)p_buf);
|
||||
|
||||
@@ -107,7 +107,7 @@ l2cap_client_t *l2cap_client_new(const l2cap_client_callbacks_t *callbacks, void
|
||||
|
||||
ret->remote_mtu = L2CAP_MTU_DEFAULT;
|
||||
ret->outbound_fragments = list_new(NULL);
|
||||
if (!ret) {
|
||||
if (!ret->outbound_fragments) {
|
||||
L2CAP_TRACE_ERROR("%s unable to allocate outbound L2CAP fragment list.", __func__);
|
||||
goto error;
|
||||
}
|
||||
@@ -393,7 +393,7 @@ static void fragment_packet(l2cap_client_t *client, buffer_t *packet)
|
||||
assert(packet != NULL);
|
||||
|
||||
// TODO(sharvil): eliminate copy into BT_HDR.
|
||||
BT_HDR *bt_packet = osi_malloc(buffer_length(packet) + L2CAP_MIN_OFFSET);
|
||||
BT_HDR *bt_packet = osi_malloc(sizeof(BT_HDR) + buffer_length(packet) + L2CAP_MIN_OFFSET);
|
||||
bt_packet->offset = L2CAP_MIN_OFFSET;
|
||||
bt_packet->len = buffer_length(packet);
|
||||
memcpy(bt_packet->data + bt_packet->offset, buffer_ptr(packet), buffer_length(packet));
|
||||
@@ -408,7 +408,7 @@ static void fragment_packet(l2cap_client_t *client, buffer_t *packet)
|
||||
break;
|
||||
}
|
||||
|
||||
BT_HDR *fragment = osi_malloc(client->remote_mtu + L2CAP_MIN_OFFSET);
|
||||
BT_HDR *fragment = osi_malloc(sizeof(BT_HDR) + client->remote_mtu + L2CAP_MIN_OFFSET);
|
||||
fragment->offset = L2CAP_MIN_OFFSET;
|
||||
fragment->len = client->remote_mtu;
|
||||
memcpy(fragment->data + fragment->offset, bt_packet->data + bt_packet->offset, client->remote_mtu);
|
||||
|
||||
Reference in New Issue
Block a user