diff options
author | Russell Belfer <rb@github.com> | 2014-03-05 13:06:22 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-03-05 13:06:22 -0800 |
commit | 26875825df19d484c24921e355963e75dc0a4476 (patch) | |
tree | b48315f4cf405b1c42d187edba5cfdbba529b692 /src/odb_loose.c | |
parent | 13f7ecd7b9c5244441eeaae798c8657d1818ea7f (diff) | |
download | libgit2-26875825df19d484c24921e355963e75dc0a4476.tar.gz |
Check short OID len in odb, not in backends
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r-- | src/odb_loose.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c index e0b6ed1f3..7b46a6652 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -647,12 +647,9 @@ static int loose_backend__read_prefix( { int error = 0; - assert(len <= GIT_OID_HEXSZ); + assert(len >= GIT_OID_MINPREFIXLEN && len <= GIT_OID_HEXSZ); - if (len < GIT_OID_MINPREFIXLEN) - error = git_odb__error_ambiguous("prefix length too short"); - - else if (len == GIT_OID_HEXSZ) { + if (len == GIT_OID_HEXSZ) { /* We can fall back to regular read method */ error = loose_backend__read(buffer_p, len_p, type_p, backend, short_oid); if (!error) @@ -698,10 +695,7 @@ static int loose_backend__exists_prefix( git_buf object_path = GIT_BUF_INIT; int error; - assert(backend && out && short_id); - - if (len < GIT_OID_MINPREFIXLEN) - return git_odb__error_ambiguous("prefix length too short"); + assert(backend && out && short_id && len >= GIT_OID_MINPREFIXLEN); error = locate_object_short_oid( &object_path, out, (loose_backend *)backend, short_id, len); |