Use calloc() instead of malloc(n * s) followed by memset().
From Jean-Philippe Ouellet.
This commit is contained in:
@@ -99,6 +99,7 @@ you believe you should be listed, please send a note to sudo@sudo.ws.
|
||||
Nieusma, Jeff
|
||||
Nikitser, Peter A.
|
||||
Nussel, Ludwig
|
||||
Ouellet, Jean-Philippe
|
||||
Paquet, Eric
|
||||
Paradis, Chantal
|
||||
Percival, Ted
|
||||
|
@@ -315,9 +315,8 @@ converse(int num_msg, PAM_CONST struct pam_message **msg,
|
||||
int ret = PAM_AUTH_ERR;
|
||||
debug_decl(converse, SUDO_DEBUG_AUTH)
|
||||
|
||||
if ((*response = malloc(num_msg * sizeof(struct pam_response))) == NULL)
|
||||
if ((*response = calloc(num_msg, sizeof(struct pam_response))) == NULL)
|
||||
debug_return_int(PAM_SYSTEM_ERR);
|
||||
memset(*response, 0, num_msg * sizeof(struct pam_response));
|
||||
|
||||
for (pr = *response, pm = *msg, n = num_msg; n--; pr++, pm++) {
|
||||
type = SUDO_CONV_PROMPT_ECHO_OFF;
|
||||
|
Reference in New Issue
Block a user