summaryrefslogtreecommitdiff
path: root/sys/dev/rnd.c
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-05 04:43:24 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-05 04:43:24 +0000
commit89c1733e626f417f7c522579fc7a22ac3e4c430a (patch)
treefd232fd4ea9173dcf4e5274167f9a3fa3b3fd091 /sys/dev/rnd.c
parent96c2585d66d817b2b30a79730654720201452ee3 (diff)
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@
Diffstat (limited to 'sys/dev/rnd.c')
-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++;