[git commit] make xmalloc_open_zipped_read_close result NUL terminated

Denys Vlasenko vda.linux at googlemail.com
Sat Dec 6 23:49:55 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=cfcd2399b20998a374ad52a5fac353f77e6ec0f6
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Compat with xmalloc_open_read_close

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 archival/libarchive/open_transformer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index 9d762a8..ab6aa3a 100644
--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -43,8 +43,9 @@ ssize_t FAST_FUNC transformer_write(transformer_state_t *xstate, const void *buf
 			nwrote = -1;
 			goto ret;
 		}
-		xstate->mem_output_buf = xrealloc(xstate->mem_output_buf, size);
+		xstate->mem_output_buf = xrealloc(xstate->mem_output_buf, size + 1);
 		memcpy(xstate->mem_output_buf + pos, buf, bufsize);
+		xstate->mem_output_buf[size] = '\0';
 		nwrote = bufsize;
 	} else {
 		nwrote = full_write(xstate->dst_fd, buf, bufsize);


More information about the busybox-cvs mailing list