mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
bluetooth: don't access outside array range
This commit is contained in:
parent
61cd6d4c19
commit
9e8c2d393a
1 changed files with 4 additions and 2 deletions
|
|
@ -448,8 +448,8 @@ static int setup_a2dp(struct userdata *u) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ((unsigned) i >= PA_ELEMENTSOF(freq_table)) {
|
||||
for (; i >= 0; i--) {
|
||||
if ((unsigned) i == PA_ELEMENTSOF(freq_table)) {
|
||||
for (--i; i >= 0; i--) {
|
||||
if (cap->frequency & freq_table[i].cap) {
|
||||
u->sample_spec.rate = freq_table[i].rate;
|
||||
cap->frequency = freq_table[i].cap;
|
||||
|
|
@ -463,6 +463,8 @@ static int setup_a2dp(struct userdata *u) {
|
|||
}
|
||||
}
|
||||
|
||||
pa_assert(i < PA_ELEMENTSOF(freq_table));
|
||||
|
||||
if (cap->capability.configured)
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue