[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [3.0] 3f2ce1e Don't panic on malformed Vary headers.
From:       Martin Blix Grydeland <martin () varnish-cache ! org>
Date:       2013-03-19 15:35:49
Message-ID: E1UHyZp-0002fl-Hi () project ! varnish-software ! com
[Download RAW message or body]

commit 3f2ce1efedb7cab76048ae62a33b59023c06cb88
Author: Martin Blix Grydeland <martin@varnish-software.com>
Date:   Mon Mar 18 17:07:46 2013 +0100

    Don't panic on malformed Vary headers.
    
    Fixes: #1275
    
    Test case by: Dag Haavi Finstad

diff --git a/bin/varnishd/cache_vary.c b/bin/varnishd/cache_vary.c
index f6ec5f2..c53a19a 100644
--- a/bin/varnishd/cache_vary.c
+++ b/bin/varnishd/cache_vary.c
@@ -134,7 +134,11 @@ VRY_Create(const struct sess *sp, const struct http *hp, struct vsb **psb)
 			q++;
 		if (*q == '\0')
 			break;
-		xxxassert(*q == ',');
+		if (*q != ',') {
+			WSP(sp, SLT_Error, "Malformed Vary header");
+			error = 1;
+			break;
+		}
 		p = q;
 	}
 
diff --git a/bin/varnishtest/tests/r01275.vtc b/bin/varnishtest/tests/r01275.vtc
new file mode 100644
index 0000000..72c7184
--- /dev/null
+++ b/bin/varnishtest/tests/r01275.vtc
@@ -0,0 +1,14 @@
+varnishtest "#1275 - panic with malformed Vary header"
+
+server s1 {
+       rxreq
+       txresp -hdr "Vary: foo bar"
+} -start
+
+varnish v1 -vcl+backend { } -start
+
+client c1 {
+       txreq
+       rxresp
+       expect resp.status == 503
+} -run

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic