From 2b1638ca50138978705051fe9ea7fd64444459b4 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 15 Sep 2006 21:14:59 +0200 Subject: [PATCH] Guard against calls of random_max() with too large range. --- lib/random.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/random.c b/lib/random.c index 87f7f544..211986b7 100644 --- a/lib/random.c +++ b/lib/random.c @@ -19,6 +19,7 @@ random_max(uns max) { uns r, l; + ASSERT(max <= (1 << 30)); l = (RAND_MAX + 1U) - ((RAND_MAX + 1U) % max); do r = random(); -- 2.39.2