Skip to content

Commit 8b3841c

Browse files
committed
fix bug in fread() failure check
the two middle arguments to fread() are easily confused, and cause the checking of return value to fail incorrectly (and possibly succeed incorrectly.)
1 parent cddef0c commit 8b3841c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tests.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4918,7 +4918,7 @@ int main(int argc, char **argv) {
49184918
}
49194919
} else {
49204920
FILE *frand = fopen("/dev/urandom", "r");
4921-
if ((frand == NULL) || fread(&seed16, sizeof(seed16), 1, frand) != sizeof(seed16)) {
4921+
if ((frand == NULL) || fread(&seed16, 1, sizeof(seed16), frand) != sizeof(seed16)) {
49224922
fprintf(stderr, "WARNING: could not read 16 bytes from /dev/urandom; falling back to insecure PRNG\n");
49234923
uint64_t t = time(NULL) * (uint64_t)1337;
49244924
seed16[0] ^= t;

0 commit comments

Comments
 (0)