mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 17:13:25 +00:00
refs: Don't allow references to inexistent OIDs
This commit is contained in:
parent
95cde17ca4
commit
9a53df7e0a
@ -1319,6 +1319,13 @@ int git_reference_set_oid(git_reference *ref, const git_oid *id)
|
|||||||
|
|
||||||
ref_oid = (reference_oid *)ref;
|
ref_oid = (reference_oid *)ref;
|
||||||
|
|
||||||
|
assert(ref->owner);
|
||||||
|
|
||||||
|
/* Don't let the user create references to OIDs that
|
||||||
|
* don't exist in the ODB */
|
||||||
|
if (!git_odb_exists(git_repository_database(ref->owner), id))
|
||||||
|
return GIT_ENOTFOUND;
|
||||||
|
|
||||||
/* duplicate the reference;
|
/* duplicate the reference;
|
||||||
* this copy will stay on the packfile cache */
|
* this copy will stay on the packfile cache */
|
||||||
if (ref->type & GIT_REF_PACKED) {
|
if (ref->type & GIT_REF_PACKED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user