]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Use countof() instead of hardcoded lengths
authorAlejandro Colomar <alx@kernel.org>
Mon, 12 Aug 2024 01:01:10 +0000 (03:01 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Mon, 16 Mar 2026 11:12:58 +0000 (12:12 +0100)
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/limits.c

index fa751104e136e3901220cefb46003e044cb6b4fc..f4244a52d5fd7e8ce30d33192a55459707423a80 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/resource.h>
 
 #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;
                }