debian: apply security fixes from 2.24.1
[git/debian.git] / debian / patches / 0043-mingw-fix-quoting-of-empty-arguments-for-sh.diff
blob36cab408639b445d4a9d4e9aad0db98e7a7004de
1 From 0f17833a6910f0be4599d040092f1cbbce661467 Mon Sep 17 00:00:00 2001
2 From: Johannes Schindelin <johannes.schindelin@gmx.de>
3 Date: Thu, 19 Sep 2019 23:38:33 +0200
4 Subject: mingw: fix quoting of empty arguments for `sh`
6 When constructing command-lines to spawn processes, it is an unfortunate
7 but necessary decision to quote arguments differently: MSYS2 has
8 different dequoting rules (inherited from Cygwin) than the rest of
9 Windows.
11 To accommodate that, Git's Windows compatibility layer has two separate
12 quoting helpers, one for MSYS2 (which it uses exclusively when spawning
13 `sh`) and the other for regular Windows executables.
15 The MSYS2 one had an unfortunate bug where a `,` somehow slipped in,
16 instead of the `;`. As a consequence, empty arguments would not be
17 enclosed in a pair of double quotes, but the closing double quote was
18 skipped.
20 Let's fix this.
22 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
23 (cherry picked from commit 04522edbd4086cd9063a8e65664c11a87bb7d89e)
24 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
25 ---
26 compat/mingw.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
29 diff --git a/compat/mingw.c b/compat/mingw.c
30 index abc4723487..8115fbafc7 100644
31 --- a/compat/mingw.c
32 +++ b/compat/mingw.c
33 @@ -1138,7 +1138,7 @@ static const char *quote_arg_msys2(const char *arg)
34 else if (!buf.len)
35 return arg;
36 else
37 - strbuf_add(&buf, p2, p - p2),
38 + strbuf_add(&buf, p2, p - p2);
40 strbuf_addch(&buf, '"');
41 return strbuf_detach(&buf, 0);
42 --
43 2.24.0.393.g34dc348eaf