summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-06-05 20:23:38 +0000
committerderaadt <deraadt@openbsd.org>2009-06-05 20:23:38 +0000
commit397dde07a7a8d9b32c597427af5f1618ba64a0a9 (patch)
tree57e0fcafdd7b7af42fe91b5d66f33019435b07c2 /lib/libc
parentuse calloc() to provide size * nitems safety; ok millert (diff)
downloadwireguard-openbsd-397dde07a7a8d9b32c597427af5f1618ba64a0a9.tar.xz
wireguard-openbsd-397dde07a7a8d9b32c597427af5f1618ba64a0a9.zip
use calloc() to provide size * nitems safety
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/rpc/svc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index 9b4b068b25e..99fb4799d77 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc.c,v 1.21 2005/12/21 01:40:22 millert Exp $ */
+/* $OpenBSD: svc.c,v 1.22 2009/06/05 20:23:38 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
@@ -102,10 +102,9 @@ __xprt_register(SVCXPRT *xprt)
while (sock + 1 > size)
size += FD_SETSIZE;
- xp = (SVCXPRT **)mem_alloc(size * sizeof(SVCXPRT *));
+ xp = (SVCXPRT **)calloc(size, sizeof(SVCXPRT *));
if (xp == NULL)
return (0);
- memset(xp, 0, size * sizeof(SVCXPRT *));
if (xports) {
memcpy(xp, xports, xportssize * sizeof(SVCXPRT *));
free(xports);