debian: apply security fixes from 2.24.1
[git/debian.git] / debian / patches / 0044-mingw-sh-arguments-need-quoting-in-more-circumstances.diff
blobee80ca64490294ce9663fb55986d8961b37af3f7
1 From 70f3b798ef7a254a367ae75b2a95c7b6c267db00 Mon Sep 17 00:00:00 2001
2 From: Johannes Schindelin <johannes.schindelin@gmx.de>
3 Date: Thu, 19 Sep 2019 23:43:03 +0200
4 Subject: mingw: sh arguments need quoting in more circumstances
6 Previously, we failed to quote characters such as '*', '(' and the
7 likes. Let's fix this.
9 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
10 (cherry picked from commit 7d8b676992ba0418aeb78f0ad1f4e193ad979b2e)
11 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 ---
13 compat/mingw.c | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
16 diff --git a/compat/mingw.c b/compat/mingw.c
17 index 8115fbafc7..bd24d913f9 100644
18 --- a/compat/mingw.c
19 +++ b/compat/mingw.c
20 @@ -1122,13 +1122,14 @@ static const char *quote_arg_msys2(const char *arg)
22 for (p = arg; *p; p++) {
23 int ws = isspace(*p);
24 - if (!ws && *p != '\\' && *p != '"' && *p != '{')
25 + if (!ws && *p != '\\' && *p != '"' && *p != '{' && *p != '\'' &&
26 + *p != '?' && *p != '*' && *p != '~')
27 continue;
28 if (!buf.len)
29 strbuf_addch(&buf, '"');
30 if (p != p2)
31 strbuf_add(&buf, p2, p - p2);
32 - if (!ws && *p != '{')
33 + if (*p == '\\' || *p == '"')
34 strbuf_addch(&buf, '\\');
35 p2 = p;
37 --
38 2.24.0.393.g34dc348eaf