Skip to content

Commit 5b4efea

Browse files
peffgitster
authored andcommitted
cvsimport: shell-quote variable used in backticks
We run `git rev-parse` though the shell, and quote its argument only with single-quotes. This prevents most metacharacters from being a problem, but misses the obvious case when $name itself has single-quotes in it. We can fix this by applying the usual shell-quoting formula. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4d4165b commit 5b4efea

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

git-cvsimport.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ sub is_sha1 {
642642

643643
sub get_headref ($) {
644644
my $name = shift;
645+
$name =~ s/'/'\\''/;
645646
my $r = `git rev-parse --verify '$name' 2>/dev/null`;
646647
return undef unless $? == 0;
647648
chomp $r;

0 commit comments

Comments
 (0)