summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sshd.c b/sshd.c
index bb830161e..28e8c1aa3 100644
--- a/sshd.c
+++ b/sshd.c
@@ -891,7 +891,7 @@ main(int ac, char **av)
891{ 891{
892 extern char *optarg; 892 extern char *optarg;
893 extern int optind; 893 extern int optind;
894 int opt, j, i, fdsetsz, on = 1; 894 int opt, j, i, on = 1;
895 int sock_in = -1, sock_out = -1, newsock = -1; 895 int sock_in = -1, sock_out = -1, newsock = -1;
896 pid_t pid; 896 pid_t pid;
897 socklen_t fromlen; 897 socklen_t fromlen;
@@ -1110,7 +1110,7 @@ main(int ac, char **av)
1110 debug("sshd version %.100s", SSH_RELEASE); 1110 debug("sshd version %.100s", SSH_RELEASE);
1111 1111
1112 /* load private host keys */ 1112 /* load private host keys */
1113 sensitive_data.host_keys = xmalloc(options.num_host_key_files * 1113 sensitive_data.host_keys = xcalloc(options.num_host_key_files,
1114 sizeof(Key *)); 1114 sizeof(Key *));
1115 for (i = 0; i < options.num_host_key_files; i++) 1115 for (i = 0; i < options.num_host_key_files; i++)
1116 sensitive_data.host_keys[i] = NULL; 1116 sensitive_data.host_keys[i] = NULL;
@@ -1212,7 +1212,7 @@ main(int ac, char **av)
1212 debug("setgroups() failed: %.200s", strerror(errno)); 1212 debug("setgroups() failed: %.200s", strerror(errno));
1213 1213
1214 if (rexec_flag) { 1214 if (rexec_flag) {
1215 rexec_argv = xmalloc(sizeof(char *) * (rexec_argc + 2)); 1215 rexec_argv = xcalloc(rexec_argc + 2, sizeof(char *));
1216 for (i = 0; i < rexec_argc; i++) { 1216 for (i = 0; i < rexec_argc; i++) {
1217 debug("rexec_argv[%d]='%s'", i, saved_argv[i]); 1217 debug("rexec_argv[%d]='%s'", i, saved_argv[i]);
1218 rexec_argv[i] = saved_argv[i]; 1218 rexec_argv[i] = saved_argv[i];
@@ -1391,7 +1391,7 @@ main(int ac, char **av)
1391 if (listen_socks[i] > maxfd) 1391 if (listen_socks[i] > maxfd)
1392 maxfd = listen_socks[i]; 1392 maxfd = listen_socks[i];
1393 /* pipes connected to unauthenticated childs */ 1393 /* pipes connected to unauthenticated childs */
1394 startup_pipes = xmalloc(options.max_startups * sizeof(int)); 1394 startup_pipes = xcalloc(options.max_startups, sizeof(int));
1395 for (i = 0; i < options.max_startups; i++) 1395 for (i = 0; i < options.max_startups; i++)
1396 startup_pipes[i] = -1; 1396 startup_pipes[i] = -1;
1397 1397
@@ -1404,9 +1404,8 @@ main(int ac, char **av)
1404 sighup_restart(); 1404 sighup_restart();
1405 if (fdset != NULL) 1405 if (fdset != NULL)
1406 xfree(fdset); 1406 xfree(fdset);
1407 fdsetsz = howmany(maxfd+1, NFDBITS) * sizeof(fd_mask); 1407 fdset = (fd_set *)xcalloc(howmany(maxfd + 1, NFDBITS),
1408 fdset = (fd_set *)xmalloc(fdsetsz); 1408 sizeof(fd_mask));
1409 memset(fdset, 0, fdsetsz);
1410 1409
1411 for (i = 0; i < num_listen_socks; i++) 1410 for (i = 0; i < num_listen_socks; i++)
1412 FD_SET(listen_socks[i], fdset); 1411 FD_SET(listen_socks[i], fdset);
@@ -1713,8 +1712,7 @@ main(int ac, char **av)
1713 packet_set_nonblocking(); 1712 packet_set_nonblocking();
1714 1713
1715 /* allocate authentication context */ 1714 /* allocate authentication context */
1716 authctxt = xmalloc(sizeof(*authctxt)); 1715 authctxt = xcalloc(1, sizeof(*authctxt));
1717 memset(authctxt, 0, sizeof(*authctxt));
1718 1716
1719 authctxt->loginmsg = &loginmsg; 1717 authctxt->loginmsg = &loginmsg;
1720 1718