From: Sami Kerola Date: Sat, 29 Jul 2017 16:19:47 +0000 (+0100) Subject: vipw: use explicit_bzero() to clear buffer after copy X-Git-Tag: v2.31-rc1~153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46df3aaae801b8d2b52b99356cd737e6e11a4e3c;p=thirdparty%2Futil-linux.git vipw: use explicit_bzero() to clear buffer after copy This should make leaking end of /etc/shadow file more unlikely. Notice that there is now way to tell to editors they should ensure none it does not leak any buffers, drop cores, and so on, when editing sensitive data. In short this change is addressing the issue only partially. Signed-off-by: Sami Kerola --- diff --git a/login-utils/vipw.c b/login-utils/vipw.c index 5999d8d150..b7650de8b9 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -100,6 +100,9 @@ static void copyfile(int from, int to) if (nr < 0) pw_error(orig_file, 1, 1); +#ifdef HAVE_EXPLICIT_BZERO + explicit_bzero(buf, sizeof(buf)); +#endif } static void pw_init(void)