diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-06-06 16:20:22 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-06-06 16:20:22 -0400 |
commit | 8cd5a3c1865c2115d88b08041a27e2cfdd7d24d2 (patch) | |
tree | 276594ce339e57431164adaf37c84a855cec34f0 /src/common/crypto.c | |
parent | 96da10aace8aa9486872a21986a191b07821a506 (diff) | |
parent | 9e3fc5f61685f937d76e60c5fa1781b80aa5bf68 (diff) | |
download | tor-8cd5a3c1865c2115d88b08041a27e2cfdd7d24d2.tar.gz tor-8cd5a3c1865c2115d88b08041a27e2cfdd7d24d2.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r-- | src/common/crypto.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 424a6f4175..05c1ce9ea2 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -2145,13 +2145,14 @@ crypto_rand(char *to, size_t n) } /** Return a pseudorandom integer, chosen uniformly from the values - * between 0 and <b>max</b>-1. */ + * between 0 and <b>max</b>-1 inclusive. <b>max</b> must be between 1 and + * INT_MAX+1, inclusive. */ int crypto_rand_int(unsigned int max) { unsigned int val; unsigned int cutoff; - tor_assert(max < UINT_MAX); + tor_assert(max <= ((unsigned int)INT_MAX)+1); tor_assert(max > 0); /* don't div by 0 */ /* We ignore any values that are >= 'cutoff,' to avoid biasing the |