[6.0] 2411ac9f6 Check we have space before adding the Date header

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:28 UTC 2018


commit 2411ac9f647da514529951b93681e148a7061558
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Mon Oct 8 10:23:38 2018 +0100

    Check we have space before adding the Date header

diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 30988ab56..23eaa0b18 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -1233,6 +1233,11 @@ http_TimeHeader(struct http *to, const char *fmt, double now)
 	char *p;
 
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
+	if (to->nhd >= to->shd) {
+		VSLb(to->vsl, SLT_LostHeader, "%s", fmt);
+		http_fail(to);
+		return;
+	}
 	p = WS_Alloc(to->ws, strlen(fmt) + VTIM_FORMAT_SIZE);
 	if (p == NULL) {
 		http_fail(to);


More information about the varnish-commit mailing list