summaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-09-11 14:24:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-12 02:10:22 (GMT)
commit5b4efea666951efe0770f8d5a301f8917015315f (patch)
tree81716c784144cb20544ef275e25cd51444493d67 /git-cvsimport.perl
parent4d4165b80d6b91a255e2847583bd4df98b5d54e1 (diff)
downloadgit-5b4efea666951efe0770f8d5a301f8917015315f.zip
git-5b4efea666951efe0770f8d5a301f8917015315f.tar.gz
git-5b4efea666951efe0770f8d5a301f8917015315f.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 1e4e65a..3692992 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -642,6 +642,7 @@ sub is_sha1 {
sub get_headref ($) {
my $name = shift;
+ $name =~ s/'/'\\''/;
my $r = `git rev-parse --verify '$name' 2>/dev/null`;
return undef unless $? == 0;
chomp $r;