From a2e701c0d4beabcf27167a34a3b9d114b4ecdf94 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Mon, 23 Aug 2021 11:39:02 +0200 Subject: [PATCH] hfp: use HFP_VR_TEXT_HEADER_SIZE that defines bytes needed for sending +BVRA message including quotes but excluding string length --- src/classic/hfp.h | 7 +++++-- src/classic/hfp_ag.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/classic/hfp.h b/src/classic/hfp.h index b5a810184..6afcac6a5 100644 --- a/src/classic/hfp.h +++ b/src/classic/hfp.h @@ -117,8 +117,11 @@ extern "C" { #define HFP_CALL_SERVICE_SIZE 3 #define HFP_MAX_NUM_CODECS 10 -#define HFP_MAX_INDICATOR_DESC_SIZE 20 -#define HFP_MAX_VR_TEXT_SIZE 100 +#define HFP_MAX_INDICATOR_DESC_SIZE 20 +#define HFP_MAX_VR_TEXT_SIZE 100 +#define HFP_VR_TEXT_HEADER_SIZE 27 // bytes needed for sending +BVRA message including quotes but excluding string length: + // \r\n+BVRA: ,,,,,""\r\n + #define HFP_MAX_NETWORK_OPERATOR_NAME_SIZE 17 #define HFP_HF_INDICATOR_UUID_ENHANCED_SAFETY 0x0001 // 0 - disabled, 1 - enabled diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index b1ca84a01..2a1949270 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -534,7 +534,7 @@ static int hfp_ag_send_voice_recognition_cmd(hfp_connection_t * hfp_connection, } static int hfp_ag_send_enhanced_voice_recognition_msg_cmd(hfp_connection_t * hfp_connection){ - char buffer[HFP_MAX_VR_TEXT_SIZE + 30]; + char buffer[HFP_VR_TEXT_HEADER_SIZE + HFP_MAX_VR_TEXT_SIZE]; snprintf(buffer, sizeof(buffer), "\r\n%s: 1,%d,%X,%d,%d,\"%s\"\r\n", HFP_ACTIVATE_VOICE_RECOGNITION, hfp_connection->ag_vra_state, hfp_connection->ag_msg.text_id,