From c2ebd210e70e6f6d85d9bfc00f4269e6bcd828d3 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 11 Jan 2024 11:47:50 +0100 Subject: [PATCH] lib/limits.c: check_logins(): Report LOGIN_ERROR_LOGIN if str2ul() ERANGE Fixes: 10396f953613 ("* libmisc/limits.c: Parse the limits, umask, nice, maxlogin, file limit with getlog() / getulong().") Link: Cc: Iker Pedrosa Signed-off-by: Alejandro Colomar --- lib/limits.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/limits.c b/lib/limits.c index 6c1a97f63..fe0e24db7 100644 --- a/lib/limits.c +++ b/lib/limits.c @@ -118,6 +118,10 @@ static int check_logins (const char *name, const char *maxlogins) unsigned long limit, count; if (str2ul(&limit, maxlogins) == -1) { + if (errno == ERANGE) { + SYSLOG((LOG_WARN, "Invalid maxlogins value\n")); + return LOGIN_ERROR_LOGIN; + } return 0; } -- 2.47.3