summaryrefslogtreecommitdiff
path: root/lib/libc/rpc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-05 20:23:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-05 20:23:07 +0000
commit2b29c155b3b2b05b5e7853dcd869dbf997b38337 (patch)
tree108a7758c59d49870317cdf02d858138a4404bd0 /lib/libc/rpc
parentc0a8479043e455913cb0d56eac2013c4ddb76df0 (diff)
use calloc() to provide size * nitems safety; ok millert
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r--lib/libc/rpc/svc_tcp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index 8d082e142b5..d38c675aac6 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_tcp.c,v 1.28 2006/04/02 00:36:05 deraadt Exp $ */
+/* $OpenBSD: svc_tcp.c,v 1.29 2009/06/05 20:23:06 deraadt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -345,12 +345,11 @@ readtcp(SVCXPRT *xprt, caddr_t buf, int len)
struct timeval tmp1, tmp2;
struct pollfd *pfd = NULL;
- pfd = (struct pollfd *)malloc(sizeof(*pfd) * (svc_max_pollfd + 1));
+ pfd = (struct pollfd *)calloc(sizeof(*pfd), (svc_max_pollfd + 1));
if (pfd == NULL)
goto fatal_err;
pfd[0].fd = sock;
pfd[0].events = POLLIN;
- pfd[0].revents = 0;
memcpy(&pfd[1], svc_pollfd, (sizeof(*pfd) * svc_max_pollfd));
/*