summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-11-17 06:04:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-17 06:05:21 (GMT)
commit68be2fea50e7a34c0e5f9fdf6adb9040c8df197f (patch)
treef85e2d46ed7d10a13722934e96baa94f591c93b0 /object.c
parent6f62cd7ab1c47a7ea32ab05cf1292d82c47310e9 (diff)
downloadgit-68be2fea50e7a34c0e5f9fdf6adb9040c8df197f.zip
git-68be2fea50e7a34c0e5f9fdf6adb9040c8df197f.tar.gz
git-68be2fea50e7a34c0e5f9fdf6adb9040c8df197f.tar.bz2
receive-pack, fetch-pack: reject bogus pack that records objects twice
When receive-pack & fetch-pack are run and store the pack obtained over the wire to a local repository, they internally run the index-pack command with the --strict option. Make sure that we reject incoming packfile that records objects twice to avoid spreading such a damage. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object.c')
-rw-r--r--object.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/object.c b/object.c
index 31976b5..d8d09f9 100644
--- a/object.c
+++ b/object.c
@@ -149,6 +149,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
struct tree *tree = lookup_tree(sha1);
if (tree) {
obj = &tree->object;
+ if (!tree->buffer)
+ tree->object.parsed = 0;
if (!tree->object.parsed) {
if (parse_tree_buffer(tree, buffer, size))
return NULL;