aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-01-18 18:47:42 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-01-18 18:52:00 +0100
commitef4a81ea0c5e0166b3df1f9bf3d186379e24d13a (patch)
tree55dc6ccf6b9f5fa9a05f83acfcb58e2a709ea2cb
parente9073a6bdb4d37f9667b76892ce230f0c1dad9c5 (diff)
downloadlibssh-ef4a81ea0c5e0166b3df1f9bf3d186379e24d13a.tar.gz
libssh-ef4a81ea0c5e0166b3df1f9bf3d186379e24d13a.tar.xz
libssh-ef4a81ea0c5e0166b3df1f9bf3d186379e24d13a.zip
auth: Use calloc() instead of malloc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/auth.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/auth.c b/src/auth.c
index bb038614..abfb5948 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -1475,7 +1475,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) {
session->kbdint->nprompts = nprompts;
session->kbdint->nanswers = nprompts;
- session->kbdint->prompts = malloc(nprompts * sizeof(char *));
+ session->kbdint->prompts = calloc(nprompts, sizeof(char *));
if (session->kbdint->prompts == NULL) {
session->kbdint->nprompts = 0;
ssh_set_error_oom(session);
@@ -1484,7 +1484,6 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) {
return SSH_PACKET_USED;
}
- memset(session->kbdint->prompts, 0, nprompts * sizeof(char *));
session->kbdint->echo = malloc(nprompts);
if (session->kbdint->echo == NULL) {
@@ -1752,12 +1751,11 @@ int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
}
if (session->kbdint->answers == NULL) {
- session->kbdint->answers = malloc(sizeof(char*) * session->kbdint->nprompts);
+ session->kbdint->answers = calloc(session->kbdint->nprompts, sizeof(char *));
if (session->kbdint->answers == NULL) {
ssh_set_error_oom(session);
return -1;
}
- memset(session->kbdint->answers, 0, sizeof(char *) * session->kbdint->nprompts);
}
if (session->kbdint->answers[i]) {