Parcourir la source

Check random_get_bytes() result before writing entropy file

Jouni Malinen il y a 13 ans
Parent
commit
15f0961447
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/crypto/random.c

+ 2 - 1
src/crypto/random.c

@@ -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) {