Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-07-15 21:33:54 +0300
committerJunio C Hamano <gitster@pobox.com>2017-07-18 00:51:32 +0300
commitf730944a49b2a210bb10520700c0a3f6c49bc020 (patch)
treedcb47674f2e675b1963ce0b3277fc686a72b7a7f /builtin/receive-pack.c
parent3ea6b85a871aa41eaa66a2919451ad12d492c355 (diff)
receive-pack: don't access hash of NULL object_id pointer
We set old_oid to NULL if we found out that it's a corrupt reference. In that case don't try to access the hash member and pass NULL to ref_transaction_delete() instead. Found with Clang's UBSan. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index b1706a5731..f589e8aebf 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1137,7 +1137,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
}
if (ref_transaction_delete(transaction,
namespaced_name,
- old_oid->hash,
+ old_oid ? old_oid->hash : NULL,
0, "push", &err)) {
rp_error("%s", err.buf);
strbuf_release(&err);