mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'contrib/github_pr_18641_v5.2' into 'release/v5.2'
fix(protocomm): prevent out-of-bounds write in console line buffer (GitHub PR) (v5.2) See merge request espressif/esp-idf!49347
This commit is contained in:
@@ -94,7 +94,7 @@ static void protocomm_console_task(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.type == UART_DATA) {
|
if (event.type == UART_DATA) {
|
||||||
while (uart_read_bytes(uart_num, (uint8_t *) &linebuf[i], 1, 0) && (i < LINE_BUF_SIZE)) {
|
while ((i < LINE_BUF_SIZE - 1) && uart_read_bytes(uart_num, (uint8_t *) &linebuf[i], 1, 0)) {
|
||||||
if (linebuf[i] == '\r') {
|
if (linebuf[i] == '\r') {
|
||||||
uart_write_bytes(uart_num, "\r\n", 2);
|
uart_write_bytes(uart_num, "\r\n", 2);
|
||||||
} else {
|
} else {
|
||||||
@@ -106,7 +106,7 @@ static void protocomm_console_task(void *arg)
|
|||||||
if ((i > 0) && (linebuf[i-1] == '\r')) {
|
if ((i > 0) && (linebuf[i-1] == '\r')) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (i < LINE_BUF_SIZE);
|
} while (i < LINE_BUF_SIZE - 1);
|
||||||
if (stopped()) {
|
if (stopped()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user