[3.0] bcc81eb Throw 503 on exceeding max 65k Vary header constituent limit.

Martin Blix Grydeland martin at varnish-cache.org
Tue Mar 19 16:35:49 CET 2013


commit bcc81eb5b516628088b24eaa23e2f851d6b80ce7
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_vary.c b/bin/varnishd/cache_vary.c
index 65a1978..a415822 100644
--- a/bin/varnishd/cache_vary.c
+++ b/bin/varnishd/cache_vary.c
@@ -125,7 +125,12 @@ VRY_Create(const struct sess *sp, const struct http *hp, struct vsb **psb)
 				e--;
 			/* Encode two byte length and contents */
 			l = e - h;
-			assert(!(l & ~0xffff));
+			if (l > 0xffff - 1) {
+				WSP(sp, SLT_Error,
+				    "Vary header maximum length exceeded");
+				error = 1;
+				break;
+			}
 		} else {
 			e = h;
 			l = 0xffff;



More information about the varnish-commit mailing list