Skip to content

Commit

Permalink
No newlines in VSC fields
Browse files Browse the repository at this point in the history
Ref #3948
  • Loading branch information
nigoroll committed Jul 7, 2023
1 parent b4968da commit 4716368
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/varnishd/common/common_vsmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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,
Expand Down

0 comments on commit 4716368

Please sign in to comment.