[SV 56449] (Windows) Use slow path if '%' appears in the command

* src/job.c (sh_chars_dos): Add '%' as a special character
* src/job.c (construct_command_argv_internal): Check for '%' in quotes

For the windows version of make, a recipe line cannot be executed
diretly by make (without a shell) if a '%' character is present. This
character starts a cmd.exe escape sequence.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Copyright-paperwork-exempt: yes
This commit is contained in:
Christian Eggers 2019-06-06 12:42:38 +02:00 committed by Paul Smith
parent d7cfbf1961
commit 38e96eadea

View file

@ -2660,7 +2660,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
can handle quoted file names just fine, removing the quote lifts
the limit from a very frequent use case, because using quoted
file names is commonplace on MS-Windows. */
static const char *sh_chars_dos = "|&<>";
static const char *sh_chars_dos = "|&<>%";
static const char *sh_cmds_dos[] =
{ "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
"ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
@ -2861,9 +2861,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
goto slow;
#ifdef WINDOWS32
/* Quoted wildcard characters must be passed quoted to the
/* Quoted wildcard and % characters must be passed quoted to the
command, so give up the fast route. */
else if (instring == '"' && strchr ("*?", *p) != 0 && !unixy_shell)
else if (instring == '"' && strchr ("*?%", *p) != 0 && !unixy_shell)
goto slow;
else if (instring == '"' && strncmp (p, "\\\"", 2) == 0)
*ap++ = *++p;