svn commit: lorikeet r52 - in trunk/heimdal/lib/krb5: .

abartlet at samba.org abartlet at samba.org
Mon Sep 6 07:29:39 GMT 2004


Author: abartlet
Date: 2004-09-06 07:29:38 +0000 (Mon, 06 Sep 2004)
New Revision: 52

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=lorikeet&path=/trunk/heimdal/lib/krb5&rev=52&nolog=1

Log:
Add a bit of parinoia to the amount of bytes we pass to RAND_add, and
fix the bug (pointed out by lha) that read returnes ssize_t, not
size_t...

Andrew Bartlett

Modified:
   trunk/heimdal/lib/krb5/crypto.c


Changeset:
Modified: trunk/heimdal/lib/krb5/crypto.c
===================================================================
--- trunk/heimdal/lib/krb5/crypto.c	2004-09-06 07:19:07 UTC (rev 51)
+++ trunk/heimdal/lib/krb5/crypto.c	2004-09-06 07:29:38 UTC (rev 52)
@@ -3724,7 +3724,7 @@
 seed_something(void)
 {
     int fd = -1;
-    size_t bytes;
+    ssize_t bytes;
     char buf[1024], seedfile[256];
 
     /* If there is a seed file, load it. But such a file cannot be trusted,
@@ -3734,7 +3734,7 @@
 	if (fd >= 0) {
 	    bytes = read(fd, buf, sizeof(buf));
 	    if (bytes > 0) {
-		RAND_add(buf, bytes, 0.0);
+		RAND_add(buf, MIN(bytes, sizeof(buf)), 0.0);
 	    } else {
 	        seedfile[0] = '\0';
 	    }



More information about the samba-cvs mailing list