Skip to content

Commit

Permalink
ref_transaction_create(): check that new_sha1 is valid
Browse files Browse the repository at this point in the history
Creating a reference requires a new_sha1 that is not NULL and not
null_sha1.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Feb 17, 2015
1 parent a933c23 commit f04c5b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3690,6 +3690,8 @@ int ref_transaction_create(struct ref_transaction *transaction,
unsigned int flags, const char *msg,
struct strbuf *err)
{
if (!new_sha1 || is_null_sha1(new_sha1))
die("BUG: create called without valid new_sha1");
return ref_transaction_update(transaction, refname, new_sha1,
null_sha1, flags, msg, err);
}
Expand Down

0 comments on commit f04c5b5

Please sign in to comment.