summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/svc_tcp.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-08-20 23:47:37 +0000
committerderaadt <deraadt@openbsd.org>1996-08-20 23:47:37 +0000
commitefbe1acafc69fa54c77c9c9a439f17eba8dee1d8 (patch)
tree1857a71879f1a705ff961ea483a812ff24bb6de6 /lib/libc/rpc/svc_tcp.c
parentnvi 1.74 (diff)
downloadwireguard-openbsd-efbe1acafc69fa54c77c9c9a439f17eba8dee1d8.tar.xz
wireguard-openbsd-efbe1acafc69fa54c77c9c9a439f17eba8dee1d8.zip
memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org
Diffstat (limited to 'lib/libc/rpc/svc_tcp.c')
-rw-r--r--lib/libc/rpc/svc_tcp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index 4482f06d459..e9bf8d440b0 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.6 1996/08/19 08:31:57 tholo Exp $";
+static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.7 1996/08/20 23:47:46 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -307,10 +307,11 @@ readtcp(xprt, buf, len)
fd_set *fds, readfds;
if (sock+1 > FD_SETSIZE) {
- fds = (fd_set *)malloc(howmany(sock+1, NBBY));
+ int bytes = howmany(sock+1, NFDBITS) * sizeof(fd_mask);
+ fds = (fd_set *)malloc(bytes);
if (fds == NULL)
goto fatal_err;
- memset(fds, '\0', howmany(sock+1, NBBY));
+ memset(fds, 0, bytes);
} else {
fds = &readfds;
FD_ZERO(fds);