summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2004-03-29 16:32:47 +0000
committerderaadt <deraadt@openbsd.org>2004-03-29 16:32:47 +0000
commit7c0f70b37ac2a12e2722fc314fedf66998a94aa6 (patch)
tree0edcb4fa0dcac183f511d00f91d97ab64136aa72
parentmemory mishandling; from ho (diff)
downloadwireguard-openbsd-7c0f70b37ac2a12e2722fc314fedf66998a94aa6.tar.xz
wireguard-openbsd-7c0f70b37ac2a12e2722fc314fedf66998a94aa6.zip
wrong FD_ZERO(); from ho, hshoexer, markus
-rw-r--r--sbin/isakmpd/monitor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index e0fffa6c8a0..f6e9e67f0c7 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.14 2004/03/23 18:20:03 hshoexer Exp $ */
+/* $OpenBSD: monitor.c,v 1.15 2004/03/29 16:32:47 deraadt Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -539,6 +539,7 @@ monitor_loop (int debugging)
{
pid_t pid;
fd_set *fds;
+ size_t fdsn;
int n, maxfd;
if (!debugging)
@@ -546,7 +547,8 @@ monitor_loop (int debugging)
maxfd = m_state.s + 1;
- fds = (fd_set *)calloc (howmany (maxfd, NFDBITS), sizeof (fd_mask));
+ fdsn = howmany (maxfd, NFDBITS) * sizeof (fd_mask);
+ fds = (fd_set *)calloc (fdsn);
if (!fds)
{
kill (m_state.pid, SIGTERM);
@@ -594,7 +596,7 @@ monitor_loop (int debugging)
monitor_sighupped = 0;
}
- FD_ZERO (fds);
+ memset (fds, 0, fdsn);
FD_SET (m_state.s, fds);
n = select (maxfd, fds, NULL, NULL, NULL);