From: Alejandro Colomar Date: Thu, 11 Jan 2024 10:47:50 +0000 (+0100) Subject: lib/limits.c: check_logins(): Report LOGIN_ERROR_LOGIN if str2ul() ERANGE X-Git-Tag: 4.17.0-rc1~123 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2ebd210e70e6f6d85d9bfc00f4269e6bcd828d3;p=thirdparty%2Fshadow.git 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 --- 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; }