diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2015-02-17 18:00:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-02-17 11:24:48 -0800 |
commit | f04c5b5522214cd48b39399d1d26b07848fd0e52 (patch) | |
tree | 732a685bb72963708b63001abd6fb57eda320f09 | |
parent | commit: avoid race when creating orphan commits (diff) | |
download | tgif-f04c5b5522214cd48b39399d1d26b07848fd0e52.tar.xz |
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 <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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); } |