diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
commit | f15cc9e98f102b443a7b1bc97ce7b524d3453c7e (patch) | |
tree | cd34ef18f375e585b2843c566e08b7a49da49084 /sbin/routed | |
parent | dd3e3e68352b843aef5b3347835e71e9f26a0d92 (diff) |
Use arc4random_buf() when requesting more than a single word of output
Use arc4random_uniform() when the desired random number upper bound
is not a power of two
ok deraadt@ millert@
Diffstat (limited to 'sbin/routed')
-rw-r--r-- | sbin/routed/main.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/routed/main.c b/sbin/routed/main.c index e57c8960ec4..e5b002c3ece 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.19 2005/03/23 18:06:07 jmc Exp $ */ +/* $OpenBSD: main.c,v 1.20 2008/04/13 00:22:17 djm Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -35,7 +35,7 @@ char copyright[] = #if !defined(lint) static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.19 2005/03/23 18:06:07 jmc Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.20 2008/04/13 00:22:17 djm Exp $"; #endif #include "defs.h" @@ -766,8 +766,8 @@ intvl_random(struct timeval *tp, /* put value here */ { tp->tv_sec = (time_t)(hi == lo ? lo - : (lo + arc4random() % ((1 + hi - lo)))); - tp->tv_usec = arc4random() % 1000000; + : (lo + arc4random_uniform(1 + hi - lo))); + tp->tv_usec = arc4random_uniform(1000000); } |