ps: ensure fields are separated by at least one space, closes 11826
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 3 May 2019 07:49:56 +0000 (09:49 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 3 May 2019 07:49:56 +0000 (09:49 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
procps/ps.c

index 54e6c40fc5cc79a4a799fbe53b9ae60c132af3f5..815c11578ae1ed6d4f3c16b56f6fd25ff841ae46 100644 (file)
@@ -533,7 +533,7 @@ static void format_process(const procps_status_t *ps)
                len = out[i].width - len + 1;
                if (++i == out_cnt) /* do not pad last field */
                        break;
-               p += sprintf(p, "%*s", len, "");
+               p += sprintf(p, "%*s", len, " "); /* " ", not "", to ensure separation of fields */
        }
        printf("%.*s\n", terminal_width, buffer);
 }