Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Dev

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

 

 

Varnish dev RSS feed   Index | Next | Previous | View Threaded


martin at varnish-software

May 8, 2012, 5:24 AM

Post #1 of 2 (238 views)
Permalink
[PATCH 1/2] Fix vmod_log (VRT_StringList returns end of string, not beginning)

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


phk at phk

May 10, 2012, 12:43 AM

Post #2 of 2 (212 views)
Permalink
Re: [PATCH 1/2] Fix vmod_log (VRT_StringList returns end of string, not beginning) [In reply to]

In message <1336479888-4745-1-git-send-email-martin [at] varnish-software>, 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
>https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>

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

_______________________________________________
varnish-dev mailing list
varnish-dev [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Varnish dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.