From ea12202288be762db38f4178d36fddfc30c3226a Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Wed, 6 Nov 2002 22:31:45 +0000 Subject: Terminate the buffer with a '\0' --- archival/libunarchive/data_extract_to_buffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/archival/libunarchive/data_extract_to_buffer.c b/archival/libunarchive/data_extract_to_buffer.c index 3fcab6d..db5521b 100644 --- a/archival/libunarchive/data_extract_to_buffer.c +++ b/archival/libunarchive/data_extract_to_buffer.c @@ -19,8 +19,10 @@ extern void data_extract_to_buffer(archive_handle_t *archive_handle) { - archive_handle->buffer = xmalloc(archive_handle->file_header->size + 1); - - archive_xread_all(archive_handle, archive_handle->buffer, archive_handle->file_header->size); + const unsigned int size = archive_handle->file_header->size; + archive_handle->buffer = xmalloc(size + 1); + + archive_xread_all(archive_handle, archive_handle->buffer, size); + archive_handle->buffer[size] = '\0'; } -- cgit v1.1