From 6024543e7923d49b4475bbacb0a88d26284ccb53 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] 0113-top: Impose a minimum on Screen_cols. The safety of the critical function task_show() depends on the sanity of Screen_cols. Just copy the tests on w_cols to Screen_cols (from the same function adj_geometry()). --- top/top.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index 976132dd..2af2a849 100644 --- a/top/top.c +++ b/top/top.c @@ -1750,7 +1750,8 @@ static void adj_geometry (void) { #endif // we might disappoint some folks (but they'll deserve it) - if (SCREENMAX < Screen_cols) Screen_cols = SCREENMAX; + if (Screen_cols > SCREENMAX) Screen_cols = SCREENMAX; + if (Screen_cols < W_MIN_COL) Screen_cols = W_MIN_COL; if (!w_set) { if (Width_mode > 0) // -w with arg, we'll try to honor