Skip to content

Commit 597d76c

Browse files
lylezhu2012fabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent be11f6f commit 597d76c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/bluetooth/host/classic/hfp_hf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,6 +3968,8 @@ static struct bt_hfp_hf *hfp_hf_create(struct bt_conn *conn)
39683968
LOG_DBG("conn %p", conn);
39693969

39703970
index = (size_t)bt_conn_index(conn);
3971+
__ASSERT(index < ARRAY_SIZE(bt_hfp_hf_pool), "Index is out of bounds");
3972+
39713973
hf = &bt_hfp_hf_pool[index];
39723974
if (hf->acl) {
39733975
LOG_ERR("HF connection (%p) is established", conn);

0 commit comments

Comments
 (0)