summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-01-10 14:01:12 +0000
committerThomas Adam <thomas@xteddy.org>2017-01-10 14:01:12 +0000
commit570943beb75d462ff5f483d47d9735ade03d9ae7 (patch)
tree600a0522c50f2e0aaa75a20571cc89f83abbb5ae /cmd.c
parent1e12e1d843ba45a7d95b866a61357c435a8acc16 (diff)
parent5ea7a00ebac6d6d6423667a3637bc575515b3be0 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index 79341078..c4c35c0e 100644
--- a/cmd.c
+++ b/cmd.c
@@ -662,7 +662,7 @@ char *
cmd_template_replace(const char *template, const char *s, int idx)
{
char ch, *buf;
- const char *ptr, *cp;
+ const char *ptr, *cp, quote[] = "\"\\$";
int replaced, quoted;
size_t len;
@@ -691,7 +691,7 @@ cmd_template_replace(const char *template, const char *s, int idx)
buf = xrealloc(buf, len + (strlen(s) * 2) + 1);
for (cp = s; *cp != '\0'; cp++) {
- if (quoted && (*cp == '"' || *cp == '$'))
+ if (quoted && strchr(quote, *cp) != NULL)
buf[len++] = '\\';
buf[len++] = *cp;
}