[master] 7b6a395 Throw 503 on exceeding max 65k Vary header constituent limit.

Martin Blix Grydeland martin at varnish-cache.org
Tue Mar 19 15:43:19 CET 2013


commit 7b6a395c8a08308560f9617d71a4d9ac1d3c44a7
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Mar 18 17:53:35 2013 +0100

    Throw 503 on exceeding max 65k Vary header constituent limit.

diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c
index be98201..ba87608 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;



More information about the varnish-commit mailing list