mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
backend-native: Fix parsing comma-delimited response
Incoming RFCOMM string has extra end-of-command terminating character which
breaks both AT+BIA= and AT+BAC= parsers which only expect a comma.
This leads to error parsing last element of response in both cases and could
prevent detecting mSBC availability if mSBC codec id comes last, e.g. AT+BIA=1,2
Fix this by additionally checking for delimiters in both parsers.
Fixes: 3c63f8e6d ("backend-native: Fix stack corruption reading RFCOMM AT+BIA= response")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/768>
This commit is contained in:
parent
c3eae5d00c
commit
33129c88dc
1 changed files with 2 additions and 2 deletions
|
|
@ -639,7 +639,7 @@ static bool hfp_rfcomm_handle(int fd, pa_bluetooth_transport *t, const char *buf
|
||||||
/* Indicators start with index 1 and follow the order of the AT+CIND=? response */
|
/* Indicators start with index 1 and follow the order of the AT+CIND=? response */
|
||||||
|
|
||||||
str = pa_xstrdup(buf + 7);
|
str = pa_xstrdup(buf + 7);
|
||||||
for (indicator = 1; (r = pa_split_in_place(str, ",", &len, &state)); indicator++) {
|
for (indicator = 1; (r = pa_split_in_place(str, ",\r\n", &len, &state)); indicator++) {
|
||||||
/* Ignore updates to mandatory indicators which are always ON */
|
/* Ignore updates to mandatory indicators which are always ON */
|
||||||
if (indicator == CIND_CALL_INDICATOR
|
if (indicator == CIND_CALL_INDICATOR
|
||||||
|| indicator == CIND_CALL_SETUP_INDICATOR
|
|| indicator == CIND_CALL_SETUP_INDICATOR
|
||||||
|
|
@ -669,7 +669,7 @@ static bool hfp_rfcomm_handle(int fd, pa_bluetooth_transport *t, const char *buf
|
||||||
|
|
||||||
/* check if codec id 2 (mSBC) is in the list of supported codecs */
|
/* check if codec id 2 (mSBC) is in the list of supported codecs */
|
||||||
str = pa_xstrdup(buf + 7);
|
str = pa_xstrdup(buf + 7);
|
||||||
while ((r = pa_split_in_place(str, ",", &len, &state))) {
|
while ((r = pa_split_in_place(str, ",\r\n", &len, &state))) {
|
||||||
if (len == 1 && r[0] == '2') {
|
if (len == 1 && r[0] == '2') {
|
||||||
c->support_msbc = true;
|
c->support_msbc = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue