diff options
| author | Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com> | 2026-03-17 13:00:34 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-17 09:14:19 -0700 |
| commit | a4fddb01c5bd0ecbd5e297ee571ad29ca62bf940 (patch) | |
| tree | f6db6091b7ab32c3c2eadcbb8ee43bb31bf4892c /mailinfo.c | |
| parent | bc6a6cf5eedb19b1b1da92ed2761ff9b1c7da627 (diff) | |
| download | git-a4fddb01c5bd0ecbd5e297ee571ad29ca62bf940.tar.xz | |
strbuf_attach: fix call sites to pass correct alloc
strbuf_attach(sb, buf, len, alloc) requires alloc > len (the buffer
must have at least len+1 bytes to hold the NUL). Several call sites
passed alloc == len, relying on strbuf_grow(sb, 0) inside strbuf_attach
to reallocate. Fix these in mailinfo, am, refs/files-backend,
fast-import, and trailer by passing len+1 when the buffer is a
NUL-terminated string (or from strbuf_detach).
Signed-off-by: Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailinfo.c')
| -rw-r--r-- | mailinfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mailinfo.c b/mailinfo.c index 99ac596e09..e52a35fde0 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -470,7 +470,7 @@ static int convert_to_utf8(struct mailinfo *mi, return error("cannot convert from %s to %s", charset, mi->metainfo_charset); } - strbuf_attach(line, out, out_len, out_len); + strbuf_attach(line, out, out_len, out_len + 1); return 0; } |
