From 06419fe95b06c7aa8670081a68dbe43a53bff303 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 1 Jul 2025 10:09:46 +0200 Subject: [PATCH] more: Use ul_strtou16() in a robust way Signed-off-by: Karel Zak --- text-utils/more.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/text-utils/more.c b/text-utils/more.c index 51c63e924..4980aef4c 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -2144,8 +2144,11 @@ int main(int argc, char **argv) if (getenv("MORESECURE") || getenv("PAGERSECURE")) ctl.is_secure = 1; - if ((s = getenv("MORE_SHELL_LINES")) && isdigit_string(s)) - ul_strtou16(s, (uint16_t *) &ctl.lines_per_screen, 10); + if ((s = getenv("MORE_SHELL_LINES")) && isdigit_string(s)) { + uint16_t x = 0; + if (ul_strtou16(s, (uint16_t *) &x, 10) == 0) + ctl.lines_per_screen = x; + } if ((s = getenv("MORE")) != NULL) env_argscan(&ctl, s); -- 2.47.2