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 /libexec/identd/parse.c | |
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 'libexec/identd/parse.c')
-rw-r--r-- | libexec/identd/parse.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c index dd4c3e11a8a..768b2ec9f3b 100644 --- a/libexec/identd/parse.c +++ b/libexec/identd/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.45 2007/09/26 02:50:36 ray Exp $ */ +/* $OpenBSD: parse.c,v 1.46 2008/04/13 00:22:17 djm Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -105,9 +105,9 @@ gentoken(char *buf, int len) return; for (p = buf; len > 1; p++, len--) { if (p == buf) - *p = token0cnv[arc4random() % (sizeof token0cnv-1)]; + *p = token0cnv[arc4random_uniform(sizeof(token0cnv)-1)]; else - *p = tokencnv[arc4random() % (sizeof tokencnv-1)]; + *p = tokencnv[arc4random_uniform(sizeof(tokencnv)-1)]; } *p = '\0'; } |