]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
sulogin: Replace STRFCPY() by STRLCPY()
authorAlejandro Colomar <alx@kernel.org>
Sat, 29 Jul 2023 15:28:23 +0000 (17:28 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Fri, 1 Sep 2023 07:39:23 +0000 (09:39 +0200)
The variable is only being read as a string (char *), so data after the
'\0' can't be leaked.

Cc: Christian Göttsche <cgzones@googlemail.com>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/sulogin.c

index 7f2d869557fa29208d51fccd61753f76d6514006..386493d161242eb664a2fc1d0ebe30885bf2f484 100644 (file)
@@ -24,6 +24,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
+#include "strlcpy.h"
 
 /*
  * Global variables
@@ -157,7 +158,7 @@ static void catch_signals (unused int sig)
 #endif
                        exit (0);
                }
-               STRFCPY (pass, cp);
+               STRLCPY(pass, cp);
                erase_pass (cp);
 
                if (valid (pass, &pwent)) {     /* check encrypted passwords ... */