Browse Source

Bluetooth: Classic: HFP_HF: Fix out of bounds issue

Check whether the conn index is out of bounds.

CID 520290

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
pull/89112/merge
Lyle Zhu 2 months ago committed by Fabio Baltieri
parent
commit
597d76ce7d
  1. 2
      subsys/bluetooth/host/classic/hfp_hf.c

2
subsys/bluetooth/host/classic/hfp_hf.c

@ -3968,6 +3968,8 @@ static struct bt_hfp_hf *hfp_hf_create(struct bt_conn *conn) @@ -3968,6 +3968,8 @@ static struct bt_hfp_hf *hfp_hf_create(struct bt_conn *conn)
LOG_DBG("conn %p", conn);
index = (size_t)bt_conn_index(conn);
__ASSERT(index < ARRAY_SIZE(bt_hfp_hf_pool), "Index is out of bounds");
hf = &bt_hfp_hf_pool[index];
if (hf->acl) {
LOG_ERR("HF connection (%p) is established", conn);

Loading…
Cancel
Save