[PATCH 8/8] Throw 503 on exceeding max 65k Vary header constituent limit.

Martin Blix Grydeland martin at varnish-software.com
Mon Mar 18 17:57:29 CET 2013


---
 bin/varnishd/cache/cache_vary.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c
index f66044a..3aab8a3 100644
--- a/bin/varnishd/cache/cache_vary.c
+++ b/bin/varnishd/cache/cache_vary.c
@@ -122,7 +122,12 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
 				e--;
 			/* Encode two byte length and contents */
 			l = e - h;
-			assert(!(l & ~0xffff));
+			if (l > 0xffff - 1) {
+				VSLb(req->vsl, SLT_Error,
+				    "Vary header maximum length exceeded");
+				error = 1;
+				break;
+			}
 		} else {
 			e = h;
 			l = 0xffff;
-- 
1.7.10.4




More information about the varnish-dev mailing list