Permalink
Browse files

Don't panic on malformed Vary headers.

Fixes: #1275

Test case by: Dag Haavi Finstad
  • Loading branch information...
1 parent e316a5f commit f8f75cb1a7f4d391bf1c0684c393c336628fb3d5 @mbgrydeland mbgrydeland committed Mar 18, 2013
Showing with 19 additions and 1 deletion.
  1. +5 −1 bin/varnishd/cache/cache_vary.c
  2. +14 −0 bin/varnishtest/tests/r01275.vtc
@@ -130,7 +130,11 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
q++;
if (*q == '\0')
break;
- xxxassert(*q == ',');
+ if (*q != ',') {
+ VSLb(req->vsl, SLT_Error, "Malformed Vary header");
+ error = 1;
+ break;
+ }
p = q;
}
@@ -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

0 comments on commit f8f75cb

Please sign in to comment.