From: Martin Mares Date: Fri, 15 Sep 2006 19:14:59 +0000 (+0200) Subject: Guard against calls of random_max() with too large range. X-Git-Tag: holmes-import~539^2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2b1638ca50138978705051fe9ea7fd64444459b4;p=libucw.git Guard against calls of random_max() with too large range. --- 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();