[master] 7ec9d11 Fix seg fault in VRT_synth_page when the string list has a NULL pointer as the first element.
Martin Blix Grydeland
martin at varnish-cache.org
Mon Aug 12 12:26:32 CEST 2013
commit 7ec9d11ee2e9d8f8e3084e6a0e95b9b97c10a93a
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Jul 22 14:13:49 2013 +0200
Fix seg fault in VRT_synth_page when the string list has a NULL
pointer as the first element.
Fixes: #1287
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index c63be80..3c86a6b 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -422,9 +422,8 @@ VRT_synth_page(const struct vrt_ctx *ctx, unsigned flags, const char *str, ...)
vsb = SMS_Makesynth(ctx->req->obj);
AN(vsb);
- VSB_cat(vsb, str);
va_start(ap, str);
- p = va_arg(ap, const char *);
+ p = str;
while (p != vrt_magic_string_end) {
if (p == NULL)
p = "(null)";
diff --git a/bin/varnishtest/tests/r01287.vtc b/bin/varnishtest/tests/r01287.vtc
new file mode 100644
index 0000000..8560ce3
--- /dev/null
+++ b/bin/varnishtest/tests/r01287.vtc
@@ -0,0 +1,21 @@
+varnishtest "#1287 - check NULL as first pointer to VRT_synth_page"
+
+server s1 {
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ return (error(200, "OK"));
+ }
+ sub vcl_error {
+ synthetic obj.http.blank;
+ return (deliver);
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+ expect resp.body == "(null)"
+} -run
More information about the varnish-commit
mailing list