fix(app_trace): prevent possible system crash on uart buffer access

This commit is contained in:
Erhan Kurubas
2025-11-28 21:26:02 +01:00
parent 495ecf6eed
commit 9da15cf246

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -288,10 +288,9 @@ static esp_err_t esp_apptrace_uart_up_buffer_put(esp_apptrace_uart_data_t *hw_da
static void esp_apptrace_uart_down_buffer_config(esp_apptrace_uart_data_t *hw_data, uint8_t *buf, uint32_t size)
{
hw_data->down_buffer = (uint8_t *)malloc(size);
if (hw_data->down_buffer == NULL){
assert(false && "Failed to allocate apptrace uart down buffer!");
}
assert(buf != NULL && "Down buffer cannot be NULL");
hw_data->down_buffer = buf;
hw_data->down_buffer_size = size;
}