From: Alejandro Colomar Date: Mon, 12 Aug 2024 01:01:10 +0000 (+0200) Subject: lib/: Use countof() instead of hardcoded lengths X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6672a730409dab89f0e4ac37cb145301f403d451;p=thirdparty%2Fshadow.git lib/: Use countof() instead of hardcoded lengths Reviewed-by: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/lib/limits.c b/lib/limits.c index fa751104e..f4244a52d 100644 --- a/lib/limits.c +++ b/lib/limits.c @@ -31,6 +31,7 @@ #include #include "atoi/a2i.h" +#include "sizeof.h" #include "string/memset/memzero.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" @@ -361,7 +362,7 @@ static int setup_user_limits (const char *uname) * * FIXME: a better (smarter) checking should be done */ - while (fgets (buf, 1024, fil) != NULL) { + while (fgets(buf, countof(buf), fil) != NULL) { if (strprefix(buf, "#") || strprefix(buf, "\n")) { continue; }