[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] assert that nobody asks for a random number between 0 and -1
- To: or-cvs@freehaven.net
- Subject: [or-cvs] assert that nobody asks for a random number between 0 and -1
- From: arma@seul.org (Roger Dingledine)
- Date: Wed,  3 Dec 2003 03:08:09 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 03 Dec 2003 03:08:47 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common
Modified Files:
	crypto.c 
Log Message:
assert that nobody asks for a random number between 0 and -1
Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- crypto.c	12 Nov 2003 04:28:30 -0000	1.43
+++ crypto.c	3 Dec 2003 08:08:07 -0000	1.44
@@ -1013,6 +1013,7 @@
   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