diff options
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r-- | ssh-keyscan.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index c7296938b..07b679442 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -54,7 +54,7 @@ int maxfd; | |||
54 | 54 | ||
55 | extern char *__progname; | 55 | extern char *__progname; |
56 | fd_set *read_wait; | 56 | fd_set *read_wait; |
57 | size_t read_wait_size; | 57 | size_t read_wait_nfdset; |
58 | int ncon; | 58 | int ncon; |
59 | int nonfatal_fatal = 0; | 59 | int nonfatal_fatal = 0; |
60 | jmp_buf kexjmp; | 60 | jmp_buf kexjmp; |
@@ -634,10 +634,10 @@ conloop(void) | |||
634 | } else | 634 | } else |
635 | seltime.tv_sec = seltime.tv_usec = 0; | 635 | seltime.tv_sec = seltime.tv_usec = 0; |
636 | 636 | ||
637 | r = xmalloc(read_wait_size); | 637 | r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
638 | memcpy(r, read_wait, read_wait_size); | 638 | e = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
639 | e = xmalloc(read_wait_size); | 639 | memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
640 | memcpy(e, read_wait, read_wait_size); | 640 | memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
641 | 641 | ||
642 | while (select(maxfd, r, NULL, e, &seltime) == -1 && | 642 | while (select(maxfd, r, NULL, e, &seltime) == -1 && |
643 | (errno == EAGAIN || errno == EINTR)) | 643 | (errno == EAGAIN || errno == EINTR)) |
@@ -804,12 +804,10 @@ main(int argc, char **argv) | |||
804 | fatal("%s: not enough file descriptors", __progname); | 804 | fatal("%s: not enough file descriptors", __progname); |
805 | if (maxfd > fdlim_get(0)) | 805 | if (maxfd > fdlim_get(0)) |
806 | fdlim_set(maxfd); | 806 | fdlim_set(maxfd); |
807 | fdcon = xmalloc(maxfd * sizeof(con)); | 807 | fdcon = xcalloc(maxfd, sizeof(con)); |
808 | memset(fdcon, 0, maxfd * sizeof(con)); | ||
809 | 808 | ||
810 | read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask); | 809 | read_wait_nfdset = howmany(maxfd, NFDBITS); |
811 | read_wait = xmalloc(read_wait_size); | 810 | read_wait = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
812 | memset(read_wait, 0, read_wait_size); | ||
813 | 811 | ||
814 | if (fopt_count) { | 812 | if (fopt_count) { |
815 | Linebuf *lb; | 813 | Linebuf *lb; |