[master] 09f5878 Use unsigned chars when creating the secret file, in order to not annoy FlexeLint.

Poul-Henning Kamp phk at varnish-cache.org
Fri Nov 8 11:47:02 CET 2013


commit 09f58783a3f0ebc1f0421e1712b49d32a8385683
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Nov 8 10:46:23 2013 +0000

    Use unsigned chars when creating the secret file, in order to
    not annoy FlexeLint.

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 5debd26..d21324f 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -317,7 +317,7 @@ make_secret(const char *dirname)
 	char *fn;
 	int fd;
 	int i;
-	char buf[256];
+	unsigned char buf[256];
 
 	assert(asprintf(&fn, "%s/_.secret", dirname) > 0);
 
@@ -329,7 +329,7 @@ make_secret(const char *dirname)
 	}
 	srandomdev();
 	for (i = 0; i < sizeof buf; i++)
-		buf[i] = random();
+		buf[i] = random() & 0xff;
 	assert(sizeof buf == write(fd, buf, sizeof buf));
 	AZ(close(fd));
 	return (fn);



More information about the varnish-commit mailing list