From 3aa348ad77476f01a44b5fb98c5a6f33cc3ceadf Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Fri, 26 Jan 2018 00:00:00 -0600 Subject: [PATCH] top: avoid potential truncation with 'Inspect' feature As it turns out, that Ukrainian 'demo' text supporting the '=' command was 152 bytes long, up from an English version of 80 bytes. Unfortunately, the buffer used to format all such strings was insufficient at 128 bytes. Depending on the width of one's terminal, some strange result could be experienced when a multi-byte sequence was truncated. So, this just makes that buffer bigger. 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 217bd712..71475d2b 100644 --- a/top/top.c +++ b/top/top.c @@ -2863,7 +2863,7 @@ static int insp_view_choice (struct pids_stack *obj) { #define makFS(dst) { if (Insp_sel->flen < 22) \ snprintf(dst, sizeof(dst), "%s", Insp_sel->fstr); \ else snprintf(dst, sizeof(dst), "%.19s...", Insp_sel->fstr); } - char buf[SMLBUFSIZ]; + char buf[LRGBUFSIZ]; int key, curlin = 0, curcol = 0; signify_that: