Use non-exiting allocatings in the sudoers plugin.

This commit is contained in:
Todd C. Miller
2015-06-17 06:49:59 -06:00
parent 6da04821d7
commit d004b02fc6
36 changed files with 1073 additions and 810 deletions

View File

@@ -67,6 +67,7 @@ int
sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
{
char challenge[256];
size_t challenge_len;
static char *orig_prompt = NULL, *new_prompt = NULL;
static int op_len, np_size;
static struct RFC1938 rfc1938;
@@ -110,9 +111,15 @@ sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
}
/* Get space for new prompt with embedded challenge */
if (np_size < op_len + strlen(challenge) + 7) {
np_size = op_len + strlen(challenge) + 7;
new_prompt = sudo_erealloc(new_prompt, np_size);
challenge_len = strlen(challenge);
if (np_size < op_len + challenge_len + 7) {
char *p = realloc(new_prompt, op_len + challenge_len + 7);
if (p == NULL) {
sudo_warnx(U_("unable to allocate memory"));
debug_return_int(AUTH_FATAL);
}
np_size = op_len + challenge_len + 7;
new_prompt = p;
}
if (def_long_otp_prompt)