Description
Describe the bug
At line 283 of the function get_new_call()
in the file zephyr/subsys/bluetooth/host/classic/hfp_ag.c, when accessing a fixed-length data, it is not considered whether the array will cross the boundary.
zephyr/subsys/bluetooth/host/classic/hfp_ag.c
Line 283 in 265cfb4
However, this issue is not possible at present because all callers of the get_new_call()
function will confirm that the length of number is less than the buffer size before calling the function get_new_call()
.
zephyr/subsys/bluetooth/host/classic/hfp_ag.c
Lines 2519 to 2526 in 265cfb4
zephyr/subsys/bluetooth/host/classic/hfp_ag.c
Lines 3838 to 3841 in 265cfb4
To avoid potential array out-of-bounds access issues and easy to maintain, improve it.