[master] 471636824 No newlines in VSC fields

Nils Goroll nils.goroll at uplex.de
Fri Jul 7 10:00:17 UTC 2023


commit 471636824ccfbd217a0abf35250738396b3fdcaa
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Jul 7 11:58:41 2023 +0200

    No newlines in VSC fields
    
    Ref #3948

diff --git a/bin/varnishd/common/common_vsmw.c b/bin/varnishd/common/common_vsmw.c
index 758ac82fa..275d8f05c 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -151,6 +151,11 @@ vsmw_idx_head(const struct vsmw *vsmw, int fd)
 	assert(write(fd, buf, strlen(buf)) == strlen(buf));
 }
 
+#define ASSERT_SEG_STR(x) do {			\
+		AN(x);				\
+		AZ(strchr(x, '\n'));		\
+	} while (0);
+
 static void
 vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg, char act)
 {
@@ -159,6 +164,9 @@ vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg, char act)
 	CHECK_OBJ_NOTNULL(vsmw, VSMW_MAGIC);
 	CHECK_OBJ_NOTNULL(seg, VSMWSEG_MAGIC);
 	AN(seg->cluster);
+	ASSERT_SEG_STR(seg->category);
+	ASSERT_SEG_STR(seg->id);
+
 	VSB_printf(vsmw->vsb, "%c %s %zu %zu %s %s\n",
 	    act,
 	    seg->cluster->fn,


More information about the varnish-commit mailing list