[PATCH 3/6] strbuf: use `strbuf_attach()` correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <martin.agren@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux