diff options
Diffstat (limited to 'archival/libunarchive/data_extract_to_buffer.c')
-rw-r--r-- | archival/libunarchive/data_extract_to_buffer.c | 8 |
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'; } |