mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
console: linenoiseProbe: check if response is valid
Previously linenoiseProbe would accept any 4 byte response, even one that isn't expected. This adds a check that the first byte of the response is ESC. Suggested in https://github.com/espressif/esp-idf/issues/8839.
This commit is contained in:
@@ -1057,6 +1057,10 @@ int linenoiseProbe(void) {
|
|||||||
if (cb < 0) {
|
if (cb < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (read_bytes == 0 && c != '\x1b') {
|
||||||
|
/* invalid response */
|
||||||
|
break;
|
||||||
|
}
|
||||||
read_bytes += cb;
|
read_bytes += cb;
|
||||||
}
|
}
|
||||||
/* Restore old mode */
|
/* Restore old mode */
|
||||||
|
Reference in New Issue
Block a user