From aa4de2d4b29fc7bdb15a207d44682a173ab874b6 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 10 Jan 2017 18:10:24 +0000 Subject: [PATCH] Need to escape ; twice because the command list parser will eat one, reported by Theo Buehler. --- cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd.c b/cmd.c index 9dfff885..9119f7ac 100644 --- a/cmd.c +++ b/cmd.c @@ -690,10 +690,14 @@ cmd_template_replace(const char *template, const char *s, int idx) if (quoted) ptr++; - buf = xrealloc(buf, len + (strlen(s) * 2) + 1); + buf = xrealloc(buf, len + (strlen(s) * 3) + 1); for (cp = s; *cp != '\0'; cp++) { if (quoted && strchr(quote, *cp) != NULL) buf[len++] = '\\'; + if (quoted && *cp == ';') { + buf[len++] = '\\'; + buf[len++] = '\\'; + } buf[len++] = *cp; } buf[len] = '\0';