From efbe1acafc69fa54c77c9c9a439f17eba8dee1d8 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 20 Aug 1996 23:47:37 +0000 Subject: memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org --- lib/libc/rpc/svc_tcp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libc/rpc/svc_tcp.c') 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); -- cgit v1.2.3-59-g8ed1b