From: Martin Ågren Date: Sat, 18 Apr 2020 20:18:26 GMT Subject: [PATCH 3/6] strbuf: use `strbuf_attach()` correctly Message-ID: In-Reply-To: Similar to earlier commits, don't pass in the same value for `len` and `alloc` to `strbuf_attach()`. This string comes from `reencode_string_iconv()` which ensures we have an extra byte at the end. Signed-off-by: Martin Ågren --- strbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strbuf.c b/strbuf.c index bb0065ccaf..deb338412e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -152,7 +152,7 @@ int strbuf_reencode(struct strbuf *sb, const char *from, const char *to) if (!out) return -1; - strbuf_attach(sb, out, len, len); + strbuf_attach(sb, out, len, len + 1); return 0; } -- 2.26.1