summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2009-06-05 04:43:23 +0000
committerguenther <guenther@openbsd.org>2009-06-05 04:43:23 +0000
commitb0db5e124668adcc026c47e3ea178da2ab1edee7 (patch)
tree451c60da8327fc04cf72e5f2d0190cda0a5bb0d8
parentUpdate to Reinoud Zandijk's much more current version of ecma167-udf.h (diff)
downloadwireguard-openbsd-b0db5e124668adcc026c47e3ea178da2ab1edee7.tar.xz
wireguard-openbsd-b0db5e124668adcc026c47e3ea178da2ab1edee7.zip
Sanity check: we overrun the rnd_ed[] array if nbits is 32, but that
should be impossible given the multi-order delta logic ok deraadt@
-rw-r--r--sys/dev/rnd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index 2602a5cbe30..0443af856ed 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.99 2008/12/15 06:00:38 djm Exp $ */
+/* $OpenBSD: rnd.c,v 1.100 2009/06/05 04:43:23 guenther Exp $ */
/*
* rnd.c -- A strong random number generator
@@ -668,6 +668,10 @@ enqueue_randomness(int state, int val)
} else if (p->max_entropy)
nbits = 8 * sizeof(val) - 1;
+ /* given the multi-order delta logic above, this should never happen */
+ if (nbits >= 32)
+ return;
+
mtx_enter(&rndlock);
if ((rep = rnd_put()) == NULL) {
rndstats.rnd_drops++;