summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-01-10 18:10:24 +0000
committernicm <nicm@openbsd.org>2017-01-10 18:10:24 +0000
commit38a4b723fc74c783f071761101d390563fb5e9c4 (patch)
treeaf693262f3098d556dc174a704924a8f41f7bf9a /usr.bin/tmux/cmd.c
parentwhitespace (diff)
downloadwireguard-openbsd-38a4b723fc74c783f071761101d390563fb5e9c4.tar.xz
wireguard-openbsd-38a4b723fc74c783f071761101d390563fb5e9c4.zip
Need to escape ; twice because the command list parser will eat one,
reported by Theo Buehler.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 5703e6f5ab3..46534f72495 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.131 2017/01/10 11:58:30 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.132 2017/01/10 18:10:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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';