aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/unix_procs/es_unix.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-01-03 03:57:33 +0000
committerlloyd <[email protected]>2009-01-03 03:57:33 +0000
commitf9027c938fc4e2b911d367094533f9acba375586 (patch)
tree0cacbf79a5caef550a4c232c5cdb61dc277a005b /src/entropy/unix_procs/es_unix.cpp
parent338895f290ab5d197da596836ecc03625f9091f3 (diff)
In the Unix entropy source fast poll, clear the stat buf before
we call stat. Apparently on 32-bit Linux (or at least on Ubuntu 8.04/x86), struct stat has some padding bytes, which are not written to by the syscall, but valgrind doesn't realize that this is OK, and warns about uninitialized memory access when we read the contents of the struct. Since this data is then fed into the PRNG, the PRNG state and output becomes tainted, which makes valgrind's output rather useless.
Diffstat (limited to 'src/entropy/unix_procs/es_unix.cpp')
-rw-r--r--src/entropy/unix_procs/es_unix.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/entropy/unix_procs/es_unix.cpp b/src/entropy/unix_procs/es_unix.cpp
index cf7e0a8e5..124a08da7 100644
--- a/src/entropy/unix_procs/es_unix.cpp
+++ b/src/entropy/unix_procs/es_unix.cpp
@@ -68,6 +68,7 @@ u32bit Unix_EntropySource::fast_poll(byte buf[], u32bit length)
for(u32bit j = 0; stat_targets[j]; j++)
{
struct stat statbuf;
+ clear_mem(&statbuf, 1);
::stat(stat_targets[j], &statbuf);
buf_i = xor_into_buf(buf, buf_i, length, statbuf);
}