From 8b3841c91daf7b75ed1bf81fa07db69d1688e8b6 Mon Sep 17 00:00:00 2001 From: Don Viszneki Date: Mon, 5 Mar 2018 18:45:00 -0800 Subject: [PATCH] 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.) --- src/tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests.c b/src/tests.c index 05314572c0f91..67559ea0bdb5d 100644 --- a/src/tests.c +++ b/src/tests.c @@ -4918,7 +4918,7 @@ int main(int argc, char **argv) { } } else { FILE *frand = fopen("/dev/urandom", "r"); - if ((frand == NULL) || fread(&seed16, sizeof(seed16), 1, frand) != sizeof(seed16)) { + if ((frand == NULL) || fread(&seed16, 1, sizeof(seed16), frand) != sizeof(seed16)) { fprintf(stderr, "WARNING: could not read 16 bytes from /dev/urandom; falling back to insecure PRNG\n"); uint64_t t = time(NULL) * (uint64_t)1337; seed16[0] ^= t;