Terminate the buffer with a '\0'

This commit is contained in:
Glenn L McGrath 2002-11-06 22:31:45 +00:00
parent 0288c8e543
commit ea12202288

View File

@ -19,8 +19,10 @@
extern void data_extract_to_buffer(archive_handle_t *archive_handle) extern void data_extract_to_buffer(archive_handle_t *archive_handle)
{ {
archive_handle->buffer = xmalloc(archive_handle->file_header->size + 1); const unsigned int size = archive_handle->file_header->size;
archive_xread_all(archive_handle, archive_handle->buffer, 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';
} }