[PATCH 1/2] Fix vmod_log (VRT_StringList returns end of string, not beginning)

Martin Blix Grydeland martin at varnish-software.com
Tue May 8 14:24:47 CEST 2012


---
 lib/libvmod_std/vmod_std.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 5b5c0aa..8ae9ec1 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -147,19 +147,18 @@ vmod_random(struct sess *sp, double lo, double hi)
 void __match_proto__()
 vmod_log(struct sess *sp, const char *fmt, ...)
 {
-	char *p;
 	unsigned u;
 	va_list ap;
 	txt t;
 
 	u = WS_Reserve(sp->req->ws, 0);
-	p = sp->req->ws->f;
+	t.b = sp->req->ws->f;
 	va_start(ap, fmt);
-	p = VRT_StringList(p, u, fmt, ap);
+	t.e = VRT_StringList(t.b, u, fmt, ap);
 	va_end(ap);
-	if (p != NULL) {
-		t.b = p;
-		t.e = strchr(p, '\0');
+	if (t.e != NULL) {
+		assert(t.e > t.b);
+		t.e--;
 		VSLbt(sp->req->vsl, SLT_VCL_Log, t);
 	}
 	WS_Release(sp->req->ws, 0);
-- 
1.7.4.1




More information about the varnish-dev mailing list