[PATCH libXdmcp] Fix compilation error when arc4random_buf is not available

Benjamin Tissoires benjamin.tissoires at gmail.com
Thu May 4 09:12:13 UTC 2017


Not sure how I missed that, but I did.

Also rename emulate_getrandom_buf() into insecure_getrandom_buf() as
requested in the previous patch reviews.

Last, getbits() expects an unsigned char, so remove the warning.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
---
Obviously, I somehow even didn't compile the previous patch.
Mea maxima culpa.

Cheers,
Benjamin

 Key.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Key.c b/Key.c
index 70607d0..d61ad0e 100644
--- a/Key.c
+++ b/Key.c
@@ -65,15 +65,15 @@ getbits (long data, unsigned char *dst)
 #ifndef HAVE_ARC4RANDOM_BUF
 
 static void
-emulate_getrandom_buf (char *auth, int len)
+insecure_getrandom_buf (unsigned char *auth, int len)
 {
     long    lowbits, highbits;
 
     srandom ((int)getpid() ^ time((Time_t *)0));
     lowbits = random ();
     highbits = random ();
-    getbits (lowbits, key->data);
-    getbits (highbits, key->data + 4);
+    getbits (lowbits, auth);
+    getbits (highbits, auth + 4);
 }
 
 static void
@@ -88,7 +88,7 @@ arc4random_buf (void *auth, int len)
 	return;
 #endif /* HAVE_GETENTROPY */
 
-    emulate_getrandom_buf (auth, len);
+    insecure_getrandom_buf (auth, len);
 }
 
 #endif /* !defined(HAVE_ARC4RANDOM_BUF) */
-- 
2.9.3



More information about the xorg-devel mailing list