rand/noise.c: Fix foolish bug in the `getentropy' code.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 Sep 2019 16:03:46 +0000 (17:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 27 Sep 2019 00:18:30 +0000 (01:18 +0100)
I've probably never built this before. :-/

rand/noise.c

index 280c49c..c120e6f 100644 (file)
@@ -217,7 +217,7 @@ int noise_devrandom(rand_pool *r)
   /* --- OpenBSD-flavoured shinies --- */
 
   while (n < sizeof(buf)) {
-    nn = sizeof(buf) - nn;
+    nn = sizeof(buf) - n;
     if (nn > 256) nn = 256;
     if (getentropy(buf + n, nn)) break;
     n += nn;