Skip to content

Commit f04c5b5

Browse files
mhaggergitster
authored andcommitted
ref_transaction_create(): check that new_sha1 is valid
Creating a reference requires a new_sha1 that is not NULL and not null_sha1. Signed-off-by: Michael Haggerty <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a933c23 commit f04c5b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

refs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3690,6 +3690,8 @@ int ref_transaction_create(struct ref_transaction *transaction,
36903690
unsigned int flags, const char *msg,
36913691
struct strbuf *err)
36923692
{
3693+
if (!new_sha1 || is_null_sha1(new_sha1))
3694+
die("BUG: create called without valid new_sha1");
36933695
return ref_transaction_update(transaction, refname, new_sha1,
36943696
null_sha1, flags, msg, err);
36953697
}

0 commit comments

Comments
 (0)