From 757a3452093ca177bb9572e7c73f810800e2a118 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 26 Jun 2022 00:00:00 -0500 Subject: [PATCH] top: afford another level of protection for line input This commit just provides the final protection against possible screen corruption when processing line input. [ such corruption was limited to the input line only ] Signed-off-by: Jim Warner --- top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index 6227ff19..8868e9dc 100644 --- a/top/top.c +++ b/top/top.c @@ -1341,7 +1341,7 @@ static char *ioline (const char *prompt) { pos = strlen(buf); break; default: // what we REALLY wanted (maybe) - if (bufNXT < bufMAX && scrNXT < Screen_cols) { + if (bufNXT < bufMAX && scrNXT < Screen_cols && strlen(buf) < bufMAX) { int tot = UTF8_tab[(unsigned char)key], sav = pos; if (tot < 1) tot = 1;