Lib: check return value of fread() in crypt_prog

fixes CID 27709 found by Coverity
This commit is contained in:
Christian Beer 2015-11-04 17:55:53 +01:00
parent 92a4ffb5e6
commit b51ef0a021
1 changed files with 3 additions and 1 deletions

View File

@ -108,7 +108,9 @@ unsigned int random_int() {
if (!f) {
die("can't open /dev/random\n");
}
fread(&n, sizeof(n), 1, f);
if (1 != fread(&n, sizeof(n), 1, f)) {
die("couldn't read from /dev/random\n");
}
fclose(f);
#endif
return n;