diff options
| author | 2008-04-13 00:22:16 +0000 | |
|---|---|---|
| committer | 2008-04-13 00:22:16 +0000 | |
| commit | 66ad965f4873a0970dea06fb53c307b8385e5a94 (patch) | |
| tree | 4afc515a23e6b6330f9c5d210162905120f9188a /libexec/tftp-proxy/tftp-proxy.c | |
| parent | bring in changes as found in libossaudio (diff) | |
| download | wireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.tar.xz wireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.zip | |
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 'libexec/tftp-proxy/tftp-proxy.c')
| -rw-r--r-- | libexec/tftp-proxy/tftp-proxy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/tftp-proxy/tftp-proxy.c b/libexec/tftp-proxy/tftp-proxy.c index 52db0d683c7..d2d2875717a 100644 --- a/libexec/tftp-proxy/tftp-proxy.c +++ b/libexec/tftp-proxy/tftp-proxy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftp-proxy.c,v 1.5 2008/03/24 16:11:00 deraadt Exp $ +/* $OpenBSD: tftp-proxy.c,v 1.6 2008/04/13 00:22:17 djm Exp $ * * Copyright (c) 2005 DLS Internet Services * Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl> @@ -383,8 +383,8 @@ sock_ntop(struct sockaddr *sa) u_int16_t pick_proxy_port(void) { - return (IPPORT_HIFIRSTAUTO + (arc4random() % - (IPPORT_HILASTAUTO - IPPORT_HIFIRSTAUTO))); + return (IPPORT_HIFIRSTAUTO + + arc4random_uniform(IPPORT_HILASTAUTO - IPPORT_HIFIRSTAUTO)); } static void |
