From: Guus Sliepen Date: Thu, 31 Jul 2014 15:13:21 +0000 (+0200) Subject: Check return value of fread() when reading from /dev/urandom. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=e3937ab96f8ee256a886e14442f959b1bc0743a6;p=meshlink Check return value of fread() when reading from /dev/urandom. --- diff --git a/src/ed25519/seed.c b/src/ed25519/seed.c index 11a2e3ec..dda3ccb2 100644 --- a/src/ed25519/seed.c +++ b/src/ed25519/seed.c @@ -30,7 +30,9 @@ int ed25519_create_seed(unsigned char *seed) { return 1; } - fread(seed, 1, 32, f); + if(fread(seed, 32, 1, f) != 1) + return 1; + fclose(f); #endif