[master] 9c932e4 Don't take sizeof a char[x] parameter, trust it to be long enough.

Poul-Henning Kamp phk at varnish-cache.org
Tue Jan 25 11:33:28 CET 2011


commit 9c932e459e0a59ee84f9bb35d060c1c869e88851
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 25 10:33:04 2011 +0000

    Don't take sizeof a char[x] parameter, trust it to be long enough.

diff --git a/bin/varnishd/cache_response.c b/bin/varnishd/cache_response.c
index c210482..7065e44 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -288,7 +288,7 @@ res_WriteGunzipObj(struct sess *sp)
 /*--------------------------------------------------------------------*/
 
 static void
-res_WriteDirObj(struct sess *sp, char lenbuf[20], size_t low, size_t high)
+res_WriteDirObj(struct sess *sp, char *lenbuf, size_t low, size_t high)
 {
 	unsigned u = 0;
 	size_t ptr, off, len;
@@ -297,7 +297,7 @@ res_WriteDirObj(struct sess *sp, char lenbuf[20], size_t low, size_t high)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
 	if (sp->wrk->res_mode & RES_CHUNKED) {
-		bprintf(lenbuf, "%jx\r\n", (intmax_t)sp->obj->len);
+		sprintf(lenbuf, "%jx\r\n", (intmax_t)sp->obj->len);
 		(void)WRW_Write(sp->wrk, lenbuf, -1);
 	}
 



More information about the varnish-commit mailing list