procps/0046-top-miscellaneous-accumulated-changes-to-program-cod.patch

34 lines
1.3 KiB
Diff

Based on 0caa6d6e676c8d28b933066d19c112b02ed59245 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 7 May 2014 00:00:00 -0500
Subject: [PATCH] top: miscellaneous accumulated changes to program code
. prevent any input recall overrun if window downsized
. adjust translation notes for true column hdr maximum
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git top/top.c top/top.c
index 9f33a05..bc755f3 100644
--- top/top.c
+++ top/top.c
@@ -1183,13 +1183,13 @@ static char *ioline (const char *prompt) {
if (plin->bkw) {
plin = plin->bkw;
memset(buf, '\0', sizeof(buf));
- pos = snprintf(buf, sizeof(buf), "%s", plin->str);
+ pos = snprintf(buf, sizeof(buf), "%.*s", Screen_cols - beg - 1, plin->str);
}
break;
case kbd_DOWN:
memset(buf, '\0', sizeof(buf));
if (plin->fwd) plin = plin->fwd;
- pos = snprintf(buf, sizeof(buf), "%s", plin->str);
+ pos = snprintf(buf, sizeof(buf), "%.*s", Screen_cols - beg - 1, plin->str);
break;
default: // what we REALLY wanted (maybe)
if (isprint(key) && logCOL < bufMAX && phyCOL < Screen_cols) {