From: Glenn L McGrath Date: Fri, 13 Jul 2001 17:59:48 +0000 (-0000) Subject: Make sure there is a trailing '\0' when extracting to buffer. X-Git-Tag: 0_60_0~72 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cfeb08a1932f970f8cc8c7b73f86001389a343dd;p=oweals%2Fbusybox.git Make sure there is a trailing '\0' when extracting to buffer. --- 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); }