Merge branch 'obsd-master'

pull/714/head
Thomas Adam 2017-01-10 20:01:12 +00:00
commit db8dff6814
1 changed files with 5 additions and 1 deletions

6
cmd.c
View File

@ -689,10 +689,14 @@ cmd_template_replace(const char *template, const char *s, int idx)
if (quoted) if (quoted)
ptr++; ptr++;
buf = xrealloc(buf, len + (strlen(s) * 2) + 1); buf = xrealloc(buf, len + (strlen(s) * 3) + 1);
for (cp = s; *cp != '\0'; cp++) { for (cp = s; *cp != '\0'; cp++) {
if (quoted && strchr(quote, *cp) != NULL) if (quoted && strchr(quote, *cp) != NULL)
buf[len++] = '\\'; buf[len++] = '\\';
if (quoted && *cp == ';') {
buf[len++] = '\\';
buf[len++] = '\\';
}
buf[len++] = *cp; buf[len++] = *cp;
} }
buf[len] = '\0'; buf[len] = '\0';