summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2019-01-15 00:39:44 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-01-15 09:57:41 -0800
commitea82b2a0857e3e0449bdce4e3987dee6adbc51ae (patch)
treeed064565c3b49c8636c36dd9ce2f5ef108066f0b /http-push.c
parentmatch-trees: use hashcpy to splice trees (diff)
downloadtgif-ea82b2a0857e3e0449bdce4e3987dee6adbc51ae.tar.xz
tree-walk: store object_id in a separate member
When parsing a tree, we read the object ID directly out of the tree buffer. This is normally fine, but such an object ID cannot be used with oidcpy, which copies GIT_MAX_RAWSZ bytes, because if we are using SHA-1, there may not be that many bytes to copy. Instead, store the object ID in a separate struct member. Since we can no longer efficiently compute the path length, store that information as well in struct name_entry. Ensure we only copy the object ID into the new buffer if the path length is nonzero, as some callers will pass us an empty path with no object ID following it, and we will not want to read past the end of the buffer. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/http-push.c b/http-push.c
index cd48590912..bb802d80ee 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1311,11 +1311,11 @@ static struct object_list **process_tree(struct tree *tree,
while (tree_entry(&desc, &entry))
switch (object_type(entry.mode)) {
case OBJ_TREE:
- p = process_tree(lookup_tree(the_repository, entry.oid),
+ p = process_tree(lookup_tree(the_repository, &entry.oid),
p);
break;
case OBJ_BLOB:
- p = process_blob(lookup_blob(the_repository, entry.oid),
+ p = process_blob(lookup_blob(the_repository, &entry.oid),
p);
break;
default: