Commit 1c1b4e8a by Vicent Martí

Merge pull request #1792 from libgit2/ntk/bug/prefix_size

odb: Straighten oid prefix handling
parents 9abf7ea7 d19dd9cf
...@@ -641,10 +641,12 @@ static int loose_backend__read_prefix( ...@@ -641,10 +641,12 @@ static int loose_backend__read_prefix(
{ {
int error = 0; int error = 0;
assert(len <= GIT_OID_HEXSZ);
if (len < GIT_OID_MINPREFIXLEN) if (len < GIT_OID_MINPREFIXLEN)
error = git_odb__error_ambiguous("prefix length too short"); 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 */ /* We can fall back to regular read method */
error = loose_backend__read(buffer_p, len_p, type_p, backend, short_oid); error = loose_backend__read(buffer_p, len_p, type_p, backend, short_oid);
if (!error) if (!error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment