kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/fix_hfp_clcc_parser_bug' into 'master'
Bugfix/Fix HFP client parse CLCC command response bug Closes BT-2907 See merge request espressif/esp-idf!20904pull/10224/head
commit
6a8f528e08
|
@ -978,20 +978,25 @@ static char *bta_hf_client_parse_clcc(char *buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Abort in case offset not set because of format error */
|
||||||
|
if (offset == 0) {
|
||||||
|
APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
buffer += offset;
|
buffer += offset;
|
||||||
|
offset = 0;
|
||||||
|
|
||||||
/* check optional part */
|
/* check optional part */
|
||||||
if (*buffer == ',') {
|
if (*buffer == ',') {
|
||||||
int res2;
|
int res2 = sscanf(buffer, ",\"%32[^\"]\",%hu%n", numstr, &type, &offset);
|
||||||
|
|
||||||
res2 = sscanf(buffer, ",\"%32[^\"]\",%hu%n", numstr, &type, &offset);
|
|
||||||
if (res2 < 0) {
|
if (res2 < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res2 == 0) {
|
if (res2 == 0) {
|
||||||
res2 = sscanf(buffer, ",\"\",%hu%n", &type, &offset);
|
res2 = sscanf(buffer, ",\"\",%hu%n", &type, &offset);
|
||||||
if (res < 0) {
|
if (res2 < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,14 +1005,20 @@ static char *bta_hf_client_parse_clcc(char *buffer)
|
||||||
numstr[0] = '\0';
|
numstr[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res2 < 2) {
|
if (res2 >= 2) {
|
||||||
|
res += res2;
|
||||||
|
/* Abort in case offset not set because of format error */
|
||||||
|
if (offset == 0) {
|
||||||
|
APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
res += res2;
|
|
||||||
buffer += offset;
|
buffer += offset;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip any remaing param,as they are not defined by BT HFP spec */
|
||||||
|
AT_SKIP_REST(buffer);
|
||||||
AT_CHECK_RN(buffer);
|
AT_CHECK_RN(buffer);
|
||||||
|
|
||||||
if (res > 6) {
|
if (res > 6) {
|
||||||
|
|
Ładowanie…
Reference in New Issue