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.
pull/8968/head
Ivan Grokhotkov 2022-05-03 21:26:14 +02:00
rodzic aa1200607a
commit 6b5599bb12
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1E050E141B280628
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -1057,6 +1057,10 @@ int linenoiseProbe(void) {
if (cb < 0) {
continue;
}
if (read_bytes == 0 && c != '\x1b') {
/* invalid response */
break;
}
read_bytes += cb;
}
/* Restore old mode */