aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/data_extract_to_buffer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/archival/libunarchive/data_extract_to_buffer.c b/archival/libunarchive/data_extract_to_buffer.c
index 3fcab6d02..db5521bcb 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';
}