From: brian m. carlson Date: Mon, 16 Jul 2018 01:27:57 +0000 (+0000) Subject: strbuf: allocate space with GIT_MAX_HEXSZ X-Git-Tag: v2.19.0-rc0~112^2~11 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4b048c917f9e2cc33771b61b8f12eeac10ea8a51 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 Signed-off-by: Junio C Hamano --- diff --git a/strbuf.c b/strbuf.c index b0716ac585..030556111d 100644 --- a/strbuf.c +++ b/strbuf.c @@ -921,7 +921,7 @@ void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid, int abbrev_len) { int r; - strbuf_grow(sb, GIT_SHA1_HEXSZ + 1); + strbuf_grow(sb, GIT_MAX_HEXSZ + 1); r = find_unique_abbrev_r(sb->buf + sb->len, oid, abbrev_len); strbuf_setlen(sb, sb->len + r); }