]> granicus.if.org Git - openssl/commitdiff
Do not use uninitialized memory to seed the PRNG as it may confuse
authorLutz Jänicke <jaenicke@openssl.org>
Fri, 2 Mar 2007 17:44:55 +0000 (17:44 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Fri, 2 Mar 2007 17:44:55 +0000 (17:44 +0000)
code checking tools.
PR: 1499

crypto/rand/randfile.c

index d69bdf8b8a04031abe2c1d65df5a29347a87f98c..cec5880a8f477805578b00a9967deb527125d99d 100644 (file)
@@ -102,10 +102,8 @@ int RAND_load_file(const char *file, long bytes)
 
        if (file == NULL) return(0);
 
-       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);
        if (bytes == 0) return(ret);
 
        in=fopen(file,"rb");