]> granicus.if.org Git - procps-ng/commitdiff
top: avoid potential truncation with 'Inspect' feature
authorJim Warner <james.warner@comcast.net>
Fri, 26 Jan 2018 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@enc.com.au>
Mon, 19 Feb 2018 09:37:24 +0000 (20:37 +1100)
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 <james.warner@comcast.net>
top/top.c

index 1fbc06b1fc7d10208950095664168cf449ef99f0..49a13caf294b1927ba1dad6509251a30ea0ae0cf 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -3339,7 +3339,7 @@ static int insp_view_choice (proc_t *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: