From d19dd9cf73f1ebec135faf9fd6e702b09d3ee723 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sun, 18 Aug 2013 23:38:51 +0200 Subject: [PATCH] odb: Straighten oid prefix handling --- src/odb_loose.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)