summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2009-06-07 01:21:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2009-06-07 01:21:01 +0000
commitc3ddcbacba908d63f313a0eb0ba8fd0010b40d2e (patch)
tree7f933ae0c1722793dd41002aa2b80baee8809c60
parent48a4c3e0f435992a493206f7aec2aa9e1d87c1cf (diff)
Modify the uc_entries allocation check such that the lhs is a constant.
OK deraadt@
-rw-r--r--lib/libc/rpc/svc_udp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c
index 6e5c77d7f2c..361a107bbf2 100644
--- a/lib/libc/rpc/svc_udp.c
+++ b/lib/libc/rpc/svc_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_udp.c,v 1.17 2009/06/06 03:28:34 deraadt Exp $ */
+/* $OpenBSD: svc_udp.c,v 1.18 2009/06/07 01:21:00 millert 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
@@ -347,7 +347,7 @@ svcudp_enablecache(SVCXPRT *transp, u_long size)
}
uc->uc_size = size;
uc->uc_nextvictim = 0;
- if (size && sizeof(cache_ptr) * SPARSENESS > SIZE_MAX / size ||
+ if (size > SIZE_MAX / (sizeof(cache_ptr) * SPARSENESS) ||
(uc->uc_entries = calloc(sizeof(cache_ptr) * SPARSENESS, size)) == NULL) {
CACHE_PERROR("enablecache: could not allocate cache data");
free(uc);