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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-06-26 00:00:00 -05:00 committed by Craig Small
parent 8ca346762d
commit 757a345209

View File

@ -1341,7 +1341,7 @@ static char *ioline (const char *prompt) {
pos = strlen(buf); pos = strlen(buf);
break; break;
default: // what we REALLY wanted (maybe) 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], int tot = UTF8_tab[(unsigned char)key],
sav = pos; sav = pos;
if (tot < 1) tot = 1; if (tot < 1) tot = 1;