summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authordtucker <dtucker>2006-05-04 06:24:34 +0000
committerdtucker <dtucker>2006-05-04 06:24:34 +0000
commit15ba8859398aa73b274026121fe00b5a5f358195 (patch)
treebcf505b26715690bea5e7181799dc832a7ed6ad5 /monitor_wrap.c
parent6d96f61b6578074a5d8afca8f96d1a8ad62b5f72 (diff)
downloadopenssh-15ba8859398aa73b274026121fe00b5a5f358195.tar.gz
- (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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 8cfc8cc0..33265289 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -776,8 +776,11 @@ mm_sshpam_query(void *ctx, char **name, char **info,
*name = buffer_get_string(&m, NULL);
*info = buffer_get_string(&m, NULL);
*num = buffer_get_int(&m);
- *prompts = xmalloc((*num + 1) * sizeof(char *));
- *echo_on = xmalloc((*num + 1) * sizeof(u_int));
+ if (*num > PAM_MAX_NUM_MSG)
+ fatal("%s: recieved %u PAM messages, expected <= %u",
+ __func__, *num, PAM_MAX_NUM_MSG);
+ *prompts = xcalloc((*num + 1), sizeof(char *));
+ *echo_on = xcalloc((*num + 1), sizeof(u_int));
for (i = 0; i < *num; ++i) {
(*prompts)[i] = buffer_get_string(&m, NULL);
(*echo_on)[i] = buffer_get_int(&m);