summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2013-08-18 23:38:51 +0200
committernulltoken <emeric.fermas@gmail.com>2013-08-18 23:38:51 +0200
commitd19dd9cf73f1ebec135faf9fd6e702b09d3ee723 (patch)
tree7355ba3acf9fcdfb4eb442d0227a1759dffa71dc /src
parent51a5e13347a0f834e2d847b46d2f6002f03bd49f (diff)
downloadlibgit2-d19dd9cf73f1ebec135faf9fd6e702b09d3ee723.tar.gz
odb: Straighten oid prefix handling
Diffstat (limited to 'src')
-rw-r--r--src/odb_loose.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 76ed8e232..90e258793 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -641,10 +641,12 @@ static int loose_backend__read_prefix(
{
int error = 0;
+ assert(len <= GIT_OID_HEXSZ);
+
if (len < GIT_OID_MINPREFIXLEN)
error = git_odb__error_ambiguous("prefix length too short");
- else if (len >= GIT_OID_HEXSZ) {
+ else 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)