aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-06-26 18:33:24 -0700
committerJunio C Hamano <gitster@pobox.com>2007-06-26 18:45:29 -0700
commit68fb4650497d6acbf6d407513cd2e2d960442e3b (patch)
tree0c41cacd974ae9847dfcee977822f12e6d248baf /sha1_file.c
parentb658d50325c938d87d4891cb62e2eefb0b58a62c (diff)
parentb69ba460bb0710b2af8a20b4b0d62233f29401ec (diff)
downloadgit-68fb4650497d6acbf6d407513cd2e2d960442e3b.tar.gz
git-68fb4650497d6acbf6d407513cd2e2d960442e3b.tar.xz
Merge branch 'maint'
* maint: config: Change output of --get-regexp for valueless keys config: Complete documentation of --get-regexp cleanup merge-base test script Fix zero-object version-2 packs Ignore submodule commits when fetching over dumb protocols
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 7628ee97d..f2b1ae032 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -510,7 +510,10 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
* for offsets larger than 2^31.
*/
unsigned long min_size = 8 + 4*256 + nr*(20 + 4 + 4) + 20 + 20;
- if (idx_size < min_size || idx_size > min_size + (nr - 1)*8) {
+ unsigned long max_size = min_size;
+ if (nr)
+ max_size += (nr - 1)*8;
+ if (idx_size < min_size || idx_size > max_size) {
munmap(idx_map, idx_size);
return error("wrong index file size in %s", path);
}