summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-26 14:19:21 +1100
committerDamien Miller <djm@mindrot.org>2006-03-26 14:19:21 +1100
commit07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch)
tree098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /monitor_wrap.c
parent7cd4579eb3c5afd22ae24436fd2611cd3aa0150a (diff)
- djm@cvs.openbsd.org 2006/03/25 00:05:41
[auth-bsdauth.c auth-skey.c auth.c auth2-chall.c channels.c] [clientloop.c deattack.c gss-genr.c kex.c key.c misc.c moduli.c] [monitor.c monitor_wrap.c packet.c scard.c sftp-server.c ssh-agent.c] [ssh-keyscan.c ssh.c sshconnect.c sshconnect2.c sshd.c uuencode.c] [xmalloc.c xmalloc.h] introduce xcalloc() and xasprintf() failure-checked allocations functions and use them throughout openssh xcalloc is particularly important because malloc(nmemb * size) is a dangerous idiom (subject to integer overflow) and it is time for it to die feedback and ok deraadt@
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index e5a65491d..cd340360a 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -859,8 +859,8 @@ mm_chall_setup(char **name, char **infotxt, u_int *numprompts,
859 *name = xstrdup(""); 859 *name = xstrdup("");
860 *infotxt = xstrdup(""); 860 *infotxt = xstrdup("");
861 *numprompts = 1; 861 *numprompts = 1;
862 *prompts = xmalloc(*numprompts * sizeof(char *)); 862 *prompts = xcalloc(*numprompts, sizeof(char *));
863 *echo_on = xmalloc(*numprompts * sizeof(u_int)); 863 *echo_on = xcalloc(*numprompts, sizeof(u_int));
864 (*echo_on)[0] = 0; 864 (*echo_on)[0] = 0;
865} 865}
866 866
@@ -953,11 +953,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt,
953 953
954 mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); 954 mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
955 955
956 len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; 956 xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT);
957 p = xmalloc(len);
958 strlcpy(p, challenge, len);
959 strlcat(p, SKEY_PROMPT, len);
960 (*prompts)[0] = p;
961 xfree(challenge); 957 xfree(challenge);
962 958
963 return (0); 959 return (0);