aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-11-15 10:50:07 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2011-11-15 10:52:32 -0800
commitf5845fbbecb3500aec4266d8323c27c5833d2bf2 (patch)
treeb5927411a0e11d6db81d3e578580b9106b2e04be
parent2d834a72e4dda31866fd20d09e0368c5d966a627 (diff)
downloadkup-f5845fbbecb3500aec4266d8323c27c5833d2bf2.tar.gz
kup-f5845fbbecb3500aec4266d8323c27c5833d2bf2.tar.xz
kup-f5845fbbecb3500aec4266d8323c27c5833d2bf2.zip
kup-server: fix undefined value error after invalid git tag
When the user has specified an invalid git reference, we would try to print an error message, but had already died due to an undefined value reference. Explicitly check for the undefined value. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rwxr-xr-xkup-server6
1 files changed, 3 insertions, 3 deletions
diff --git a/kup-server b/kup-server
index 7e82307..ecd2271 100755
--- a/kup-server
+++ b/kup-server
@@ -477,7 +477,7 @@ sub get_tar_data(@)
} "Invalid git repository\n";
my ($sha, $type, $len) = check_ref($repo, $ref);
- if ($type !~ /^(tree|commit|tag)$/) {
+ if (!defined($type) || $type !~ /^(tree|commit|tag)$/) {
fatal("Invalid tree reference");
}
@@ -516,12 +516,12 @@ sub get_diff_data(@)
} "Invalid git repository\n";
my ($sha1, $type1, $len1) = check_ref($repo, $ref1);
- if ($type1 !~ /^(tree|commit|tag)$/) {
+ if (!defined($type1) || $type1 !~ /^(tree|commit|tag)$/) {
fatal("Invalid tree reference");
}
my ($sha2, $type2, $len2) = check_ref($repo, $ref2);
- if ($type2 !~ /^(tree|commit|tag)$/) {
+ if (!defined($type2) || $type2 !~ /^(tree|commit|tag)$/) {
fatal("Invalid tree reference");
}