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

Poul-Henning Kamp phk at phk.freebsd.dk
Thu May 10 09:43:38 CEST 2012


In message <1336479888-4745-1-git-send-email-martin at varnish-software.com>, Mart
in Blix Grydeland writes:


Please add a ticket + vtc case, so we keep it from reappearing.

>---
> 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
>
>
>_______________________________________________
>varnish-dev mailing list
>varnish-dev at varnish-cache.org
>https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-dev mailing list