diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-06 22:31:45 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-06 22:31:45 +0000 |
commit | ea12202288be762db38f4178d36fddfc30c3226a (patch) | |
tree | 590f8d0f47e84dc5663e8afdf9781da1f0ed749a /archival | |
parent | 0288c8e543a62fb8c5ca4200c7897eb43bbfbb41 (diff) |
Terminate the buffer with a '\0'
Diffstat (limited to 'archival')
-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'; } |