init: use explicit_bzero() for clearing passwords

This is a nop in practice, because it cannot be proven that this
particular bzero() is not significant.  Make it explicit anyways, rather
than relying on an implementation detail of how the password is
collected.

Discussed with:	Andrew Gierth <andrew tao146 riddles org uk>

(cherry picked from commit 852f70b240)
This commit is contained in:
Kyle Evans 2021-03-02 21:38:37 -06:00
parent f7488064d9
commit 223d6caabd

View file

@ -908,7 +908,7 @@ single_user(void)
if (clear == NULL || *clear == '\0')
_exit(0);
password = crypt(clear, pp->pw_passwd);
bzero(clear, _PASSWORD_LEN);
explicit_bzero(clear, _PASSWORD_LEN);
if (password != NULL &&
strcmp(password, pp->pw_passwd) == 0)
break;