]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check random_get_bytes() result before writing entropy file
authorJouni Malinen <j@w1.fi>
Fri, 15 Jul 2011 14:17:48 +0000 (17:17 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 15 Jul 2011 14:17:48 +0000 (17:17 +0300)
src/crypto/random.c

index f545917a73396204246f2b1dbe0d4d1651e35678..7f5c08a6dc94d4a635536132dd96ea180f6e4923 100644 (file)
@@ -358,7 +358,8 @@ static void random_write_entropy(void)
        if (!random_entropy_file)
                return;
 
-       random_get_bytes(buf, RANDOM_ENTROPY_SIZE);
+       if (random_get_bytes(buf, RANDOM_ENTROPY_SIZE) < 0)
+               return;
 
        f = fopen(random_entropy_file, "wb");
        if (f == NULL) {