mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-28 16:46:31 +03:00
The console transport read loop passed &linebuf[i] to uart_read_bytes() before checking i < LINE_BUF_SIZE, so a line of LINE_BUF_SIZE or more bytes without a terminator wrote one byte past the 256-byte linebuf stack array. Gate the read on the bounds check and reserve the final byte for the NUL terminator (LINE_BUF_SIZE - 1), so the buffer handed to esp_console_run() stays terminated even when an overlong line is truncated. Closes https://github.com/espressif/esp-idf/issues/18638 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>