aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-07-13 17:59:48 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-07-13 17:59:48 +0000
commitcfeb08a1932f970f8cc8c7b73f86001389a343dd (patch)
tree74c183dd9fedd8c2f160b167f0d795e4a35a14e3
parent5e66a26eaa30d348341619a365888e54dab3af1e (diff)
downloadbusybox-cfeb08a1932f970f8cc8c7b73f86001389a343dd.tar.gz
Make sure there is a trailing '\0' when extracting to buffer.
-rw-r--r--libbb/unarchive.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index 80dddb226..852bd06a8 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -102,6 +102,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
if (S_ISREG(file_entry->mode)) {
buffer = (char *) xmalloc(file_entry->size + 1);
fread(buffer, 1, file_entry->size, src_stream);
+ buffer[file_entry->size] = '\0';
archive_offset += file_entry->size;
return(buffer);
}