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 <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-07-29 17:19:47 +01:00
parent 6766397932
commit 46df3aaae8
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
1 changed files with 3 additions and 0 deletions

View File

@ -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)