aboutsummaryrefslogtreecommitdiff
path: root/crypto/rand
diff options
context:
space:
mode:
authorLutz Jänicke <jaenicke@openssl.org>2007-03-02 17:46:25 +0000
committerLutz Jänicke <jaenicke@openssl.org>2007-03-02 17:46:25 +0000
commitc9fb4e2c8d2eabe732e1d1aabd9706d55980a4a4 (patch)
tree559ddb32d88b860eeef72857d9f4b2bfdd177b8c /crypto/rand
parent6e7ca5e1ebf9e158ad0fc061e0052c0eb94b254a (diff)
downloadopenssl-c9fb4e2c8d2eabe732e1d1aabd9706d55980a4a4.zip
openssl-c9fb4e2c8d2eabe732e1d1aabd9706d55980a4a4.tar.gz
openssl-c9fb4e2c8d2eabe732e1d1aabd9706d55980a4a4.tar.bz2
Do not use uninitialized memory to seed the PRNG as it may confuse
code checking tools. PR: 1499
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/randfile.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 7533ea5..43053b1 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -103,10 +103,8 @@ int RAND_load_file(const char *file, long bytes)
if (file == NULL) return(0);
#ifndef OPENSSL_NO_POSIX_IO
- i=stat(file,&sb);
- /* If the state fails, put some crap in anyway */
+ if (stat(file,&sb) < 0) return(0);
RAND_add(&sb,sizeof(sb),0.0);
- if (i < 0) return(0);
#endif
if (bytes == 0) return(ret);