Use MEMZERO() instead of its pattern
This patch implicitly adds the safety of SIZEOF_ARRAY(), since the calls were using sizeof() instead. Cc: Christian Göttsche <cgzones@googlemail.com> Cc: Serge Hallyn <serge@hallyn.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Iker Pedrosa
parent
64ab401239
commit
f3ee47fe3f
+3
-3
@@ -899,7 +899,7 @@ static void change_passwd (struct group *gr)
|
||||
erase_pass (cp);
|
||||
cp = agetpass (_("Re-enter new password: "));
|
||||
if (NULL == cp) {
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -909,7 +909,7 @@ static void change_passwd (struct group *gr)
|
||||
}
|
||||
|
||||
erase_pass (cp);
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
|
||||
if (retries + 1 < RETRIES) {
|
||||
puts (_("They don't match; try again"));
|
||||
@@ -929,7 +929,7 @@ static void change_passwd (struct group *gr)
|
||||
Prog, salt, strerror (errno));
|
||||
exit (1);
|
||||
}
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
#ifdef SHADOWGRP
|
||||
if (is_shadowgrp) {
|
||||
gr->gr_passwd = SHADOW_PASSWD_STRING;
|
||||
|
||||
+7
-7
@@ -294,8 +294,8 @@ static int new_password (const struct passwd *pw)
|
||||
for (i = getdef_num ("PASS_CHANGE_TRIES", 5); i > 0; i--) {
|
||||
cp = agetpass (_("New password: "));
|
||||
if (NULL == cp) {
|
||||
memzero (orig, sizeof orig);
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(orig);
|
||||
MEMZERO(pass);
|
||||
return -1;
|
||||
}
|
||||
if (warned && (strcmp (pass, cp) != 0)) {
|
||||
@@ -322,8 +322,8 @@ static int new_password (const struct passwd *pw)
|
||||
}
|
||||
cp = agetpass (_("Re-enter new password: "));
|
||||
if (NULL == cp) {
|
||||
memzero (orig, sizeof orig);
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(orig);
|
||||
MEMZERO(pass);
|
||||
return -1;
|
||||
}
|
||||
if (strcmp (cp, pass) != 0) {
|
||||
@@ -334,10 +334,10 @@ static int new_password (const struct passwd *pw)
|
||||
break;
|
||||
}
|
||||
}
|
||||
memzero (orig, sizeof orig);
|
||||
MEMZERO(orig);
|
||||
|
||||
if (i == 0) {
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ static int new_password (const struct passwd *pw)
|
||||
*/
|
||||
salt = crypt_make_salt (NULL, NULL);
|
||||
cp = pw_encrypt (pass, salt);
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
|
||||
if (NULL == cp) {
|
||||
fprintf (stderr,
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ static void catch_signals (unused int sig)
|
||||
sleep (2);
|
||||
(void) puts (_("Login incorrect"));
|
||||
}
|
||||
memzero (pass, sizeof pass);
|
||||
MEMZERO(pass);
|
||||
(void) alarm (0);
|
||||
(void) signal (SIGALRM, SIG_DFL);
|
||||
environ = newenvp; /* make new environment active */
|
||||
|
||||
Reference in New Issue
Block a user