summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-06-05 20:23:06 +0000
committerderaadt <deraadt@openbsd.org>2009-06-05 20:23:06 +0000
commitd64e6cf5d2aaa3a731fe452c658e85bc6bcd4f11 (patch)
tree770158ee2d3447fd0c7cfc5c679e85a956c905f9 /lib/libc
parentcatch up NetBSD kern/41048. (diff)
downloadwireguard-openbsd-d64e6cf5d2aaa3a731fe452c658e85bc6bcd4f11.tar.xz
wireguard-openbsd-d64e6cf5d2aaa3a731fe452c658e85bc6bcd4f11.zip
use calloc() to provide size * nitems safety; ok millert
Diffstat (limited to 'lib/libc')
-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));
/*