passwd: erase password copy on all error branches
This commit is contained in:
parent
edca359022
commit
58b6e97a9e
@ -289,6 +289,7 @@ static int new_password (const struct passwd *pw)
|
|||||||
cp = getpass (_("New password: "));
|
cp = getpass (_("New password: "));
|
||||||
if (NULL == cp) {
|
if (NULL == cp) {
|
||||||
memzero (orig, sizeof orig);
|
memzero (orig, sizeof orig);
|
||||||
|
memzero (pass, sizeof pass);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (warned && (strcmp (pass, cp) != 0)) {
|
if (warned && (strcmp (pass, cp) != 0)) {
|
||||||
@ -316,6 +317,7 @@ static int new_password (const struct passwd *pw)
|
|||||||
cp = getpass (_("Re-enter new password: "));
|
cp = getpass (_("Re-enter new password: "));
|
||||||
if (NULL == cp) {
|
if (NULL == cp) {
|
||||||
memzero (orig, sizeof orig);
|
memzero (orig, sizeof orig);
|
||||||
|
memzero (pass, sizeof pass);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strcmp (cp, pass) != 0) {
|
if (strcmp (cp, pass) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user