r2014 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 25 08:44:27 CEST 2007


Author: phk
Date: 2007-09-25 08:44:27 +0200 (Tue, 25 Sep 2007)
New Revision: 2014

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
The first of a long sequence of committs, inspired by cranking up FlexeLints
nitpicking to new heights:

Make sure VRT_int_string() has enough room and assert that this was the case.



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-09-24 13:21:27 UTC (rev 2013)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-09-25 06:44:27 UTC (rev 2014)
@@ -484,11 +484,11 @@
 VRT_int_string(struct sess *sp, int num)
 {
 	char *p;
-	int size = 10;
+	int size = 12;
 	
 	p = WS_Alloc(sp->http->ws, size);
 	AN(p);
-	snprintf(p, size, "%d", num);
+	assert(snprintf(p, size, "%d", num) < size);
 	return (p);
 }
 




More information about the varnish-commit mailing list