From: phk Date: Tue, 25 Sep 2007 06:44:27 +0000 (+0000) Subject: The first of a long sequence of committs, inspired by cranking up FlexeLints X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c2b76eaa6d601c6e88213a3f426693a58ce61f3;p=varnish 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. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2014 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 11f16269..28d190e2 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -484,11 +484,11 @@ char * 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); }