summaryrefslogtreecommitdiffstats
path: root/src/diff.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-09 19:21:30 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-09 19:21:30 +0100
commit1ef73e33c9414eb02c229d8234aafd9d481a8856 (patch)
treeea8c934b8f2e1d109ab7bce70074bf0bde5dda09 /src/diff.c
parentad2cfb54b78523435b31de7234081ff70a53e736 (diff)
patch 8.0.0442: patch shell command not well escapedv8.0.0442
Problem: Patch shell command uses double quotes around the argument, which allows for $HOME to be expanded. (Etienne) Solution: Use single quotes on Unix. (closes #1543)
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index b64b45ce96..7b81feba7a 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -977,7 +977,12 @@ ex_diffpatch(exarg_T *eap)
{
/* Build the patch command and execute it. Ignore errors. Switch to
* cooked mode to allow the user to respond to prompts. */
- vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"",
+ vim_snprintf((char *)buf, buflen,
+#ifdef UNIX
+ "patch -o %s %s < '%s'",
+#else
+ "patch -o %s %s < \"%s\"",
+#endif
tmp_new, tmp_orig,
# ifdef UNIX
fullname != NULL ? fullname :