kopia lustrzana https://github.com/espressif/esp-idf
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
rodzic
aa1200607a
commit
6b5599bb12
|
@ -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 */
|
||||||
|
|
Ładowanie…
Reference in New Issue