diff --git a/system/bta/hf_client/bta_hf_client_sdp.cc b/system/bta/hf_client/bta_hf_client_sdp.cc index fce2d685d873d86ed290aaf4e656e566bd1b31ef..c7fc77b77d4d8f50dd58759fb9b5c4fd6f48693b 100644 --- a/system/bta/hf_client/bta_hf_client_sdp.cc +++ b/system/bta/hf_client/bta_hf_client_sdp.cc @@ -259,7 +259,9 @@ bool bta_hf_client_sdp_find_attr(tBTA_HF_CLIENT_CB* client_cb) { /* get features */ p_attr = get_legacy_stack_sdp_api()->record.SDP_FindAttributeInRec( p_rec, ATTR_ID_SUPPORTED_FEATURES); - if (p_attr != NULL) { + if (p_attr != NULL && + SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) == UINT_DESC_TYPE && + SDP_DISC_ATTR_LEN(p_attr->attr_len_type) >= 2) { /* Found attribute. Get value. */ /* There might be race condition between SDP and BRSF. */ /* Do not update if we already received BRSF. */ @@ -275,7 +277,9 @@ bool bta_hf_client_sdp_find_attr(tBTA_HF_CLIENT_CB* client_cb) { /* get network for ability to reject calls */ p_attr = get_legacy_stack_sdp_api()->record.SDP_FindAttributeInRec( p_rec, ATTR_ID_NETWORK); - if (p_attr != NULL) { + if (p_attr != NULL && + SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) == UINT_DESC_TYPE && + SDP_DISC_ATTR_LEN(p_attr->attr_len_type) >= 2) { if (p_attr->attr_value.v.u16 == 0x01) { client_cb->peer_features |= BTA_HF_CLIENT_PEER_REJECT; }