diff options
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_rand.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/platform/posix/posix_rand.c b/src/platform/posix/posix_rand.c index 76b2ee46..f8986e07 100644 --- a/src/platform/posix/posix_rand.c +++ b/src/platform/posix/posix_rand.c @@ -45,6 +45,8 @@ nni_plat_seed_prng(void *buf, size_t bufsz) struct nni_plat_prng_x x; int i; + memset(buf, 0, bufsz); + #if defined(NNG_USE_GETRANDOM) // Latest Linux has a nice API here. (void) getrandom(buf, bufsz, 0); @@ -72,6 +74,7 @@ nni_plat_seed_prng(void *buf, size_t bufsz) // limited of systems, we have at least *some* level of randomness. // The mixing is done in a way to avoid diminishing entropy we may // have already collected. + memset(&x, 0, sizeof (x)); // satisfy valgrind x.now = nni_clock(); x.pid = getpid(); x.uid = getuid(); |
