From bdb9a934e4b5dd14ba3c18a617874290e3853f3e Mon Sep 17 00:00:00 2001 From: zwsd Date: Fri, 8 Jul 2022 16:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E6=97=B6=E5=90=8E=EF=BC=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=AE=97=E6=98=AF=E4=B8=80=E5=8C=85=EF=BC=8C=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=95=B0=E6=8D=AE=E5=90=8E=EF=BC=8C=E8=BF=98=E5=9C=A8?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E6=98=AF=E5=8F=AF=E4=BB=A5=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E5=88=B0=E4=B8=80=E7=9B=B4=E5=9C=A8=E5=8F=91=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/gatts_demo.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main/gatts_demo.c b/main/gatts_demo.c index 3051ebc..84042f6 100644 --- a/main/gatts_demo.c +++ b/main/gatts_demo.c @@ -616,6 +616,13 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i { if (bluetooth_rx_buffer_processing == false) { + if ((bluetooth_rx_buffer_len + param->write.len) > profile_b_buffer_size) + { + ESP_LOGW(GATTS_TAG, "Array out of bounds"); + example_write_event_env(gatts_if, &b_prepare_write_env, param); + break; + } + timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); timer_start(TIMER_GROUP_0, TIMER_0); @@ -900,10 +907,6 @@ void bluetooth_gatts_try_process_data() ESP_LOGI(GATTS_TAG, "%s", &bluetooth_rx_buffer[0]); //处理数据 - while (1) - { - /* code */ - } // buffer置0 buffer_all_init();