Commit 2571b7e
Bluetooth: Classic: HFP_HF: Fix invalid indicator index issue
A invalid indicator index will cause the underflow of the array
`ag_ind` if the indicator index is not returned by AG in the
response of AT command `AT+CIND=?`.
Replace hardcoded `-1` values with HFP_HF_INDICATOR_INVALID constant
for better code readability and maintainability. Add proper bounds
checking to validate indicator indices before accessing the `ag_ind`
array using the `ind_table` mapping.
Signed-off-by: Lyle Zhu <[email protected]>1 parent 75ff93a commit 2571b7e
1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
1336 | 1338 | | |
1337 | 1339 | | |
1338 | 1340 | | |
1339 | | - | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1340 | 1352 | | |
1341 | 1353 | | |
1342 | 1354 | | |
| |||
2790 | 2802 | | |
2791 | 2803 | | |
2792 | 2804 | | |
2793 | | - | |
| 2805 | + | |
| 2806 | + | |
2794 | 2807 | | |
2795 | 2808 | | |
2796 | 2809 | | |
| |||
4433 | 4446 | | |
4434 | 4447 | | |
4435 | 4448 | | |
4436 | | - | |
4437 | | - | |
| 4449 | + | |
| 4450 | + | |
4438 | 4451 | | |
4439 | 4452 | | |
4440 | 4453 | | |
| |||
0 commit comments