]> granicus.if.org Git - procps-ng/commitdiff
top: Limit Width_mode to SCREENMAX.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:33:15 +0000 (07:33 +1000)
adj_geometry() limits to SCREENMAX too, but belt and suspenders, and
might as well tell the user about it.

top/top.c

index 7eb1c660f8dfff2b5c0948ae5dd148e905bb0675..621372173b6176cd53d853f6c93907cbc4b94f9c 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -4112,7 +4112,7 @@ static void parse_args (char **args) {
                if (cp[1]) pn = &cp[1];
                else if (*args) { pn = *args; ai = 1; }
                if (pn && !(ci = strspn(pn, numbs_str))) { ai = 0; pn = NULL; }
-               if (pn && (!mkfloat(pn, &tmp, 1) || tmp < W_MIN_COL))
+               if (pn && (!mkfloat(pn, &tmp, 1) || tmp < W_MIN_COL || tmp > SCREENMAX))
                   error_exit(fmtmk(N_fmt(BAD_widtharg_fmt), pn));
                Width_mode = (int)tmp;
                cp++;