Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d68af29

Browse files
author
Sim Domingo
committed
fix error message SHA truncation for lengths other than GIT_OID_HEXSZ
1 parent ceed221 commit d68af29

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/odb.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,10 +1361,8 @@ int git_odb__error_notfound(
13611361
const char *message, const git_oid *oid, size_t oid_len)
13621362
{
13631363
if (oid != NULL) {
1364-
size_t buf_len = oid_len;
13651364
char oid_str[GIT_OID_HEXSZ + 1];
1366-
if (oid_len == GIT_OID_HEXSZ) buf_len++;
1367-
git_oid_tostr(oid_str, buf_len, oid);
1365+
git_oid_tostr(oid_str, oid_len+1, oid);
13681366
giterr_set(GITERR_ODB, "Object not found - %s (%.*s)",
13691367
message, oid_len, oid_str);
13701368
} else

0 commit comments

Comments
 (0)