[master] c2cef8f Make VRT_String() mark the workspace as overflowed and VRT_CollectString() fail the VCL on overflows.

Poul-Henning Kamp phk at FreeBSD.org
Thu Feb 8 10:12:06 UTC 2018


commit c2cef8fc51d0c09bcef63aa0660f0dd894f138de
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Feb 8 09:19:05 2018 +0000

    Make VRT_String() mark the workspace as overflowed and
    VRT_CollectString() fail the VCL on overflows.
    
    VRT_StringList() can be used in the rare and probably
    non-existent cases where overflow-marking is undesired.

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index b0f5619..cbb4f88 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -268,10 +268,7 @@ VRT_String(struct ws *ws, const char *h, const char *p, va_list ap)
 	}
 	b = VRT_StringList(b, e > b ? e - b : 0, p, ap);
 	if (b == NULL || b == e) {
-		/*
-		 * NO WS_MarkOverflow here because the caller might have a
-		 * fallback
-		 */
+		WS_MarkOverflow(ws);
 		WS_Release(ws, 0);
 		return (NULL);
 	}
@@ -296,6 +293,8 @@ VRT_CollectString(VRT_CTX, const char *p, ...)
 	va_start(ap, p);
 	b = VRT_String(ctx->ws, NULL, p, ap);
 	va_end(ap);
+	if (b == NULL)
+		VRT_fail(ctx, "Workspace overflow");
 	return (b);
 }
 


More information about the varnish-commit mailing list