sudo_passwd_cleanup: Set auth->data to NULL after freeing.
GitHub issue #201
This commit is contained in:
@@ -117,11 +117,14 @@ sudo_passwd_verify(struct passwd *pw, const char *pass, sudo_auth *auth, struct
|
|||||||
int
|
int
|
||||||
sudo_passwd_cleanup(struct passwd *pw, sudo_auth *auth, bool force)
|
sudo_passwd_cleanup(struct passwd *pw, sudo_auth *auth, bool force)
|
||||||
{
|
{
|
||||||
char *pw_epasswd = auth->data;
|
|
||||||
debug_decl(sudo_passwd_cleanup, SUDOERS_DEBUG_AUTH);
|
debug_decl(sudo_passwd_cleanup, SUDOERS_DEBUG_AUTH);
|
||||||
|
|
||||||
if (pw_epasswd != NULL)
|
if (auth->data != NULL) {
|
||||||
freezero(pw_epasswd, strlen(pw_epasswd));
|
/* Zero out encrypted password before freeing. */
|
||||||
|
size_t len = strlen((char *)auth->data);
|
||||||
|
freezero(auth->data, len);
|
||||||
|
auth->data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
debug_return_int(AUTH_SUCCESS);
|
debug_return_int(AUTH_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user