From: Alejandro Colomar Date: Sat, 29 Jul 2023 15:56:46 +0000 (+0200) Subject: login: Replace STRFCPY() by STRLCPY() X-Git-Tag: 4.15.0-rc1~193 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcc25a03cd448597472c076e6fae0c0face0693e;p=thirdparty%2Fshadow.git login: Replace STRFCPY() by STRLCPY() The variable is only being read as a string (char *), so data after the '\0' can't be leaked. Cc: Christian Göttsche Cc: Serge Hallyn Cc: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/src/login.c b/src/login.c index 84002232d..9faec8189 100644 --- a/src/login.c +++ b/src/login.c @@ -36,6 +36,7 @@ /*@-exitarg@*/ #include "exitcodes.h" #include "shadowlog.h" +#include "strlcpy.h" #ifdef USE_PAM #include "pam_defs.h" @@ -552,7 +553,7 @@ int main (int argc, char **argv) if (NULL == tmptty) { tmptty = "UNKNOWN"; } - STRFCPY (tty, tmptty); + STRLCPY(tty, tmptty); #ifndef USE_PAM is_console = console (tty);