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>
brian m. carlson committed
Jul 16, 2018 at 01:27 UTC
4b048c917f9e2cc33771b61b8f12eeac10ea8a51
1 file changed
+1
-1
strbuf.c
+1
-1
@@ -921,7 +921,7 @@ void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
921
int abbrev_len)
922
{
923
int r;
924
- strbuf_grow(sb, GIT_SHA1_HEXSZ + 1);
924
+ strbuf_grow(sb, GIT_MAX_HEXSZ + 1);
925
r = find_unique_abbrev_r(sb->buf + sb->len, oid, abbrev_len);
926
strbuf_setlen(sb, sb->len + r);
927
}