diff options
author | Darren Tucker <dtucker@zip.com.au> | 2006-05-04 16:24:34 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2006-05-04 16:24:34 +1000 |
commit | d8093e49bf06813a8c97cbc90810f4863388af77 (patch) | |
tree | 186c431180b5e63c14733c5d92a5cdb988426fca /monitor_wrap.c | |
parent | 596d33801f6d703c1e45c74df6f6d6fe7ee085bb (diff) |
- (dtucker) [auth-pam.c groupaccess.c monitor.c monitor_wrap.c scard-opensc.c
session.c ssh-rand-helper.c sshd.c openbsd-compat/bsd-cygwin_util.c
openbsd-compat/setproctitle.c] Convert malloc(foo*bar) -> calloc(foo,bar)
in Portable-only code; since calloc zeros, remove now-redundant memsets.
Also add a couple of sanity checks. With & ok djm@
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r-- | monitor_wrap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c index 8cfc8cc08..332652895 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c | |||
@@ -776,8 +776,11 @@ mm_sshpam_query(void *ctx, char **name, char **info, | |||
776 | *name = buffer_get_string(&m, NULL); | 776 | *name = buffer_get_string(&m, NULL); |
777 | *info = buffer_get_string(&m, NULL); | 777 | *info = buffer_get_string(&m, NULL); |
778 | *num = buffer_get_int(&m); | 778 | *num = buffer_get_int(&m); |
779 | *prompts = xmalloc((*num + 1) * sizeof(char *)); | 779 | if (*num > PAM_MAX_NUM_MSG) |
780 | *echo_on = xmalloc((*num + 1) * sizeof(u_int)); | 780 | fatal("%s: recieved %u PAM messages, expected <= %u", |
781 | __func__, *num, PAM_MAX_NUM_MSG); | ||
782 | *prompts = xcalloc((*num + 1), sizeof(char *)); | ||
783 | *echo_on = xcalloc((*num + 1), sizeof(u_int)); | ||
781 | for (i = 0; i < *num; ++i) { | 784 | for (i = 0; i < *num; ++i) { |
782 | (*prompts)[i] = buffer_get_string(&m, NULL); | 785 | (*prompts)[i] = buffer_get_string(&m, NULL); |
783 | (*echo_on)[i] = buffer_get_int(&m); | 786 | (*echo_on)[i] = buffer_get_int(&m); |