1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

For some combinations of variable sizes and RAND_MAX value rand_r()

may store less amount bits for seed, than available. Fix it.
This commit is contained in:
Andrey A. Chernov 2003-02-02 14:27:51 +00:00
parent b7f305981e
commit 62c4150e1e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110236

View File

@ -86,8 +86,10 @@ int
rand_r(unsigned int *ctx)
{
u_long val = (u_long) *ctx;
*ctx = do_rand(&val);
return (int) *ctx;
int r = do_rand(&val);
*ctx = (unsigned int) val;
return (r);
}