[experimental-ims] 5b3e41b Fix vmod_log (VRT_StringList returns end of string, not beginning)

Martin Blix Grydeland martin at varnish-software.com
Thu Dec 18 10:27:46 CET 2014


commit 5b3e41b4958ea33012ef290c706e6c45d540d361
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Apr 24 14:21:42 2012 +0200

    Fix vmod_log (VRT_StringList returns end of string, not beginning)
    
    Fixes: #1135

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);



More information about the varnish-commit mailing list