diff --git a/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_at.c b/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_at.c index 32470215968..1e3c3b00893 100644 --- a/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_at.c +++ b/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_at.c @@ -595,7 +595,7 @@ while (*buf == ' ') buf++; buf += sizeof("\r\n") - 1; /* skip rest of AT string up to */ -#define AT_SKIP_REST(buf) while(*buf != '\r') buf++; +#define AT_SKIP_REST(buf) while((*buf != '\r') && (*buf != '\0')) buf++; static char *bta_hf_client_parse_ok(char *buffer) {