From: Michael Haggerty Date: Tue, 17 Feb 2015 17:00:19 +0000 (+0100) Subject: ref_transaction_create(): check that new_sha1 is valid X-Git-Tag: v2.4.0-rc0~73^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f04c5b552;p=thirdparty%2Fgit.git 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 Reviewed-by: Stefan Beller Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index e3c4ab5fd5..b9cf284f31 100644 --- a/refs.c +++ b/refs.c @@ -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); }