Skip to content

Commit 4b048c9

Browse files
bk2204gitster
authored andcommitted
strbuf: allocate space with GIT_MAX_HEXSZ
In order to be sure we have enough space to use with any hash algorithm, use GIT_MAX_HEXSZ to allocate space. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2770ccb commit 4b048c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
921921
int abbrev_len)
922922
{
923923
int r;
924-
strbuf_grow(sb, GIT_SHA1_HEXSZ + 1);
924+
strbuf_grow(sb, GIT_MAX_HEXSZ + 1);
925925
r = find_unique_abbrev_r(sb->buf + sb->len, oid, abbrev_len);
926926
strbuf_setlen(sb, sb->len + r);
927927
}

0 commit comments

Comments
 (0)