From 46df3aaae801b8d2b52b99356cd737e6e11a4e3c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 29 Jul 2017 17:19:47 +0100 Subject: [PATCH] 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 --- login-utils/vipw.c | 3 +++ 1 file changed, 3 insertions(+) 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) -- 2.47.3