debian: apply security fixes from 2.24.1
[git/debian.git] / debian / patches / 0003-fast-import-tighten-parsing-of-boolean-command-line-o.diff
blobcd37fab8c87e96da1978af70fd798ad8114cd7a7
1 From 973ddb4475c54d85c32449652b039d030e03bb8e Mon Sep 17 00:00:00 2001
2 From: Jeff King <peff@peff.net>
3 Date: Thu, 29 Aug 2019 11:25:45 -0400
4 Subject: fast-import: tighten parsing of boolean command line options
6 We parse options like "--max-pack-size=" using skip_prefix(), which
7 makes sense to get at the bytes after the "=". However, we also parse
8 "--quiet" and "--stats" with skip_prefix(), which allows things like
9 "--quiet-nonsense" to behave like "--quiet".
11 This was a mistaken conversion in 0f6927c229 (fast-import: put option
12 parsing code in separate functions, 2009-12-04). Let's tighten this to
13 an exact match, which was the original intent.
15 Signed-off-by: Jeff King <peff@peff.net>
16 (cherry picked from commit 11e934d56e46875b24d8a047d44b45ff243f6715)
17 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
18 ---
19 fast-import.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
22 diff --git a/fast-import.c b/fast-import.c
23 index 9503d087b2..dbd6b72957 100644
24 --- a/fast-import.c
25 +++ b/fast-import.c
26 @@ -3230,9 +3230,9 @@ static int parse_one_option(const char *option)
27 option_active_branches(option);
28 } else if (skip_prefix(option, "export-pack-edges=", &option)) {
29 option_export_pack_edges(option);
30 - } else if (starts_with(option, "quiet")) {
31 + } else if (!strcmp(option, "quiet")) {
32 show_stats = 0;
33 - } else if (starts_with(option, "stats")) {
34 + } else if (!strcmp(option, "stats")) {
35 show_stats = 1;
36 } else {
37 return 0;
38 --
39 2.24.0.393.g34dc348eaf