Implement memset_s() and use it instead of zero_bytes().
A new constant, SUDO_CONV_REPL_MAX, is defined by the plugin API as the max conversation reply length. This constant can be used as a max value for memset_s() when clearing passwords filled in by the conversation function.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2005, 2008, 2010-2012
|
||||
* Copyright (c) 1999-2005, 2008, 2010-2013
|
||||
* Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
@@ -82,7 +82,7 @@ int
|
||||
sudo_fwtk_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
|
||||
{
|
||||
char *pass; /* Password from the user */
|
||||
char buf[SUDO_PASS_MAX + 12]; /* General prupose buffer */
|
||||
char buf[SUDO_CONV_REPL_MAX + 12]; /* General prupose buffer */
|
||||
char resp[128]; /* Response from the server */
|
||||
int error;
|
||||
debug_decl(sudo_fwtk_verify, SUDO_DEBUG_AUTH)
|
||||
@@ -139,8 +139,8 @@ restart:
|
||||
warningx("%s", resp);
|
||||
error = AUTH_FAILURE;
|
||||
done:
|
||||
zero_bytes(pass, strlen(pass));
|
||||
zero_bytes(buf, strlen(buf));
|
||||
memset_s(pass, SUDO_PASS_MAX, 0, strlen(pass));
|
||||
memset_s(buf, sizeof(buf), 0, sizeof(buf));
|
||||
debug_return_int(error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user