diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-01 12:10:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-01 12:10:25 +0200 |
commit | 2886dccebaec2da55e5a99bd88d44ae4217dee6e (patch) | |
tree | cfa697e6fce0fbb8e85af28cb68d8185c9802722 /src/ex_cmds.c | |
parent | 792cf5e1bec04c6d6d70cfbb9ef24c798b469731 (diff) | |
download | vim-git-2886dccebaec2da55e5a99bd88d44ae4217dee6e.tar.gz |
patch 8.1.2105: MS-Windows: system() may crashv8.1.2105
Problem: MS-Windows: system() may crash.
Solution: Do not use "itmp" when it is NULL. (Yasuhiro Matsumoto,
closes #5005)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 9d58ab41a..85e5be066 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1778,28 +1778,30 @@ make_filter_cmd( } else { - char_u *p; - - /* - * If there is a pipe, we have to put the '<' in front of it. - * Don't do this when 'shellquote' is not empty, otherwise the - * redirection would be inside the quotes. - */ - if (*p_shq == NUL) - { - p = find_pipe(buf); - if (p != NULL) - *p = NUL; - } - STRCAT(buf, " <"); /* " < " causes problems on Amiga */ - STRCAT(buf, itmp); - if (*p_shq == NUL) + STRCPY(buf, cmd); + if (itmp != NULL) { - p = find_pipe(cmd); - if (p != NULL) + char_u *p; + + // If there is a pipe, we have to put the '<' in front of it. + // Don't do this when 'shellquote' is not empty, otherwise the + // redirection would be inside the quotes. + if (*p_shq == NUL) { - STRCAT(buf, " "); /* insert a space before the '|' for DOS */ - STRCAT(buf, p); + p = find_pipe(buf); + if (p != NULL) + *p = NUL; + } + STRCAT(buf, " <"); // " < " causes problems on Amiga + STRCAT(buf, itmp); + if (*p_shq == NUL) + { + p = find_pipe(cmd); + if (p != NULL) + { + STRCAT(buf, " "); // insert a space before the '|' for DOS + STRCAT(buf, p); + } } } } |