]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/salt.c: Use stprintf() instead of snprintf(3)
authorAlejandro Colomar <alx@kernel.org>
Sat, 8 Feb 2025 15:36:26 +0000 (16:36 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Fri, 15 May 2026 10:06:49 +0000 (12:06 +0200)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/salt.c

index e662e03c17497edae0343331c9d495805c6db069..4a66d0132c3ea09cafce80f98b589adad65d17e0 100644 (file)
@@ -23,6 +23,7 @@
 #include "getdef.h"
 #include "prototypes.h"
 #include "shadowlog.h"
+#include "string/sprintf/stprintf.h"
 #include "string/strcmp/streq.h"
 
 #undef NDEBUG
@@ -172,7 +173,7 @@ static /*@observer@*/void SHA_salt_rounds_to_buf (char *buf, unsigned long round
         */
        assert (GENSALT_SETTING_SIZE > buf_begin + 17);
 
-       (void) snprintf (buf + buf_begin, 18, "rounds=%lu$", rounds);
+       stprintf(buf + buf_begin, 18, "rounds=%lu$", rounds);
 }
 
 #ifdef USE_BCRYPT
@@ -250,7 +251,7 @@ static /*@observer@*/void BCRYPT_salt_rounds_to_buf (char *buf, unsigned long ro
         */
        assert (GENSALT_SETTING_SIZE > buf_begin + 3);
 
-       (void) snprintf (buf + buf_begin, 4, "%2.2lu$", rounds);
+       stprintf(buf + buf_begin, 4, "%2.2lu$", rounds);
 }
 #endif /* USE_BCRYPT */