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();