From 3423bbc5ea9bcd29902abbf46771902752a13fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=93=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D1=83=D1=88=D0=BA=D0=BE?= Date: Fri, 24 Nov 2023 00:47:18 +0300 Subject: [PATCH] console: linenoiseProbe: check if response is valid --- components/console/linenoise/linenoise.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/console/linenoise/linenoise.c b/components/console/linenoise/linenoise.c index 7674cbf..ee7f3d1 100644 --- a/components/console/linenoise/linenoise.c +++ b/components/console/linenoise/linenoise.c @@ -1206,6 +1206,10 @@ int linenoiseProbe() { if (cb < 0) { continue; } + if (read_bytes == 0 && c != '\x1b') { + /* invalid response */ + break; + } read_bytes += cb; } /* Restore old mode */