Skip to content

Commit 6a04f83

Browse files
committed
Merge branch 'fix/apptrace_uart_crash_v5.4' into 'release/v5.4'
fix(app_trace): prevent possible system crash on uart buffer access (v5.4) See merge request espressif/esp-idf!43861
2 parents 3a527b6 + 9da15cf commit 6a04f83

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

components/app_trace/port/port_uart.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -288,10 +288,9 @@ static esp_err_t esp_apptrace_uart_up_buffer_put(esp_apptrace_uart_data_t *hw_da
288288

289289
static void esp_apptrace_uart_down_buffer_config(esp_apptrace_uart_data_t *hw_data, uint8_t *buf, uint32_t size)
290290
{
291-
hw_data->down_buffer = (uint8_t *)malloc(size);
292-
if (hw_data->down_buffer == NULL){
293-
assert(false && "Failed to allocate apptrace uart down buffer!");
294-
}
291+
assert(buf != NULL && "Down buffer cannot be NULL");
292+
293+
hw_data->down_buffer = buf;
295294
hw_data->down_buffer_size = size;
296295
}
297296

0 commit comments

Comments
 (0)