aboutsummaryrefslogtreecommitdiffstats
path: root/hash-ll.h
diff options
context:
space:
mode:
Diffstat (limited to 'hash-ll.h')
-rw-r--r--hash-ll.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/hash-ll.h b/hash-ll.h
index dbb96369fc..b72f84f4ae 100644
--- a/hash-ll.h
+++ b/hash-ll.h
@@ -288,6 +288,8 @@ static inline void oidread(struct object_id *oid, const unsigned char *hash,
const struct git_hash_algo *algop)
{
memcpy(oid->hash, hash, algop->rawsz);
+ if (algop->rawsz < GIT_MAX_RAWSZ)
+ memset(oid->hash + algop->rawsz, 0, GIT_MAX_RAWSZ - algop->rawsz);
oid->algo = hash_algo_by_ptr(algop);
}