[PATCH 05/17] strbuf: allocate space with GIT_MAX_HEXSZ
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jul 8, 2018, 23:36 UTC
- Message-ID
- <20180708233638.520172-6-sandals@crustytoothpaste.net>
- In-Reply-To
- <20180708233638.520172-1-sandals@crustytoothpaste.net>
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> --- strbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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); }