From 7bfcf1724c4885879a3001710c143385140678d5 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 29 Jul 2023 18:04:30 +0200 Subject: [PATCH] gpasswd: Replace STRFCPY() by STRLCPY() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gpasswd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gpasswd.c b/src/gpasswd.c index 12fbc807..fbf50cbd 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -32,8 +32,9 @@ #endif /*@-exitarg@*/ #include "exitcodes.h" - #include "shadowlog.h" +#include "strlcpy.h" + /* * Global variables */ @@ -895,7 +896,7 @@ static void change_passwd (struct group *gr) exit (1); } - STRFCPY (pass, cp); + STRLCPY(pass, cp); erase_pass (cp); cp = agetpass (_("Re-enter new password: ")); if (NULL == cp) {