summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/crypto.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 551af89642..6b7f0c29f7 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1013,6 +1013,7 @@ int crypto_pseudo_rand_int(unsigned int max) {
unsigned int val;
unsigned int cutoff;
assert(max < UINT_MAX);
+ assert(max > 0); /* don't div by 0 */
/* We ignore any values that are >= 'cutoff,' to avoid biasing the
* distribution with clipping at the upper end of unsigned int's