]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: use explicit_bzero() to get rid of confidental memory
authorSami Kerola <kerolasa@iki.fi>
Fri, 13 Nov 2020 20:55:19 +0000 (20:55 +0000)
committerSami Kerola <kerolasa@iki.fi>
Thu, 3 Dec 2020 20:07:29 +0000 (20:07 +0000)
Earlier code was most probably correct, but it is best to be safe than sorry
when dealing with confidental data removals.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/login.c

index 28ca8b41ae3e3417862d34bd32ca9183b13cbef6..4f0296c422f2c22dda4a243130055c174ff15e26 100644 (file)
@@ -1336,8 +1336,12 @@ static void initialize(int argc, char **argv, struct login_context *cxt)
 
                /* Wipe the name - some people mistype their password here. */
                /* (Of course we are too late, but perhaps this helps a little...) */
+#ifdef HAVE_EXPLICIT_BZERO
+               explicit_bzero(p, strlen(p));
+#else
                while (*p)
                        *p++ = ' ';
+#endif
        }
 
        close_all_fds(wanted_fds, ARRAY_SIZE(wanted_fds));