Fix shell command injection issues
[git/debian.git] / debian / patches / cvsserver-use-safe_pipe_capture-for-constant-commands.diff
blob1b0787f5e9527ad4cf31ec07f34aa0f4dd05bc91
1 From 1a5908d9ca5601d5f3030fb58dcd886f8bbc4be3 Mon Sep 17 00:00:00 2001
2 From: Junio C Hamano <gitster@pobox.com>
3 Date: Mon, 11 Sep 2017 14:45:54 +0900
4 Subject: cvsserver: use safe_pipe_capture for `constant commands` as well
6 This is not strictly necessary, but it is a good code hygiene.
8 Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 ---
10 git-cvsserver.perl | 8 ++++----
11 1 file changed, 4 insertions(+), 4 deletions(-)
13 diff --git a/git-cvsserver.perl b/git-cvsserver.perl
14 index bd29b26cc2..ae1044273d 100755
15 --- a/git-cvsserver.perl
16 +++ b/git-cvsserver.perl
17 @@ -356,7 +356,7 @@ sub req_Root
18 return 0;
21 - my @gitvars = `git config -l`;
22 + my @gitvars = safe_pipe_capture(qw(git config -l));
23 if ($?) {
24 print "E problems executing git-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
25 print "E \n";
26 @@ -943,7 +943,7 @@ sub req_co
28 # Provide list of modules, if -c was used.
29 if (exists $state->{opt}{c}) {
30 - my $showref = `git show-ref --heads`;
31 + my $showref = safe_pipe_capture(qw(git show-ref --heads));
32 for my $line (split '\n', $showref) {
33 if ( $line =~ m% refs/heads/(.*)$% ) {
34 print "M $1\t$1\n";
35 @@ -1181,7 +1181,7 @@ sub req_update
36 # projects (heads in this case) to checkout.
38 if ($state->{module} eq '') {
39 - my $showref = `git show-ref --heads`;
40 + my $showref = safe_pipe_capture(qw(git show-ref --heads));
41 print "E cvs update: Updating .\n";
42 for my $line (split '\n', $showref) {
43 if ( $line =~ m% refs/heads/(.*)$% ) {
44 @@ -1687,7 +1687,7 @@ sub req_ci
45 return;
48 - my $treehash = `git write-tree`;
49 + my $treehash = safe_pipe_capture(qw(git write-tree));
50 chomp $treehash;
52 $log->debug("Treehash : $treehash, Parenthash : $parenthash");
53 --
54 2.14.1.821.g8fa685d3b7