From: Alejandro Colomar Date: Thu, 8 Jun 2023 18:33:13 +0000 (+0200) Subject: chage: Replace STRFCPY() by STRLCPY() X-Git-Tag: 4.15.0-rc1~198 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5579b40e357a69df434b7549680d2e13ffab16e0;p=thirdparty%2Fshadow.git chage: Replace STRFCPY() by STRLCPY() The variables are only being read as strings (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/chage.c b/src/chage.c index b8a11e8c4..6896cb15a 100644 --- a/src/chage.c +++ b/src/chage.c @@ -33,6 +33,7 @@ #include "pwio.h" #include "shadowio.h" #include "shadowlog.h" +#include "strlcpy.h" #ifdef WITH_TCB #include "tcbfuncs.h" #endif @@ -822,7 +823,7 @@ int main (int argc, char **argv) fail_exit (E_NOPERM); } - STRFCPY (user_name, pw->pw_name); + STRLCPY(user_name, pw->pw_name); #ifdef WITH_TCB if (shadowtcb_set_user (pw->pw_name) == SHADOWTCB_FAILURE) { fail_exit (E_NOPERM);