diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 22:02:38 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-23 22:02:38 +0200 |
commit | e5fdec93e273855c1bcc2579b83cfb481a9a1492 (patch) | |
tree | c56035c96ba1229600afcc83882ddcfe43198c6b /src | |
parent | Added debug/full_flush.c. (diff) | |
download | xz-e5fdec93e273855c1bcc2579b83cfb481a9a1492.tar.xz |
Add the trailing '\0' to lzma_extra.data as the API header
already documents.
Diffstat (limited to 'src')
-rw-r--r-- | src/liblzma/common/metadata_decoder.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liblzma/common/metadata_decoder.c b/src/liblzma/common/metadata_decoder.c index 356a9e31..298a424c 100644 --- a/src/liblzma/common/metadata_decoder.c +++ b/src/liblzma/common/metadata_decoder.c @@ -366,7 +366,8 @@ process(lzma_coder *coder, lzma_allocator *allocator) coder->extra_tail->size = (size_t)(coder->tmp); coder->tmp = 0; - uint8_t *d = lzma_alloc((size_t)(coder->extra_tail->size), + // We reserve space for the trailing '\0' too. + uint8_t *d = lzma_alloc((size_t)(coder->extra_tail->size) + 1, allocator); if (d == NULL) return LZMA_MEM_ERROR; @@ -383,6 +384,7 @@ process(lzma_coder *coder, lzma_allocator *allocator) (size_t)(coder->extra_tail->size)); if ((size_t)(coder->extra_tail->size) == coder->pos) { + coder->extra_tail->data[coder->pos] = '\0'; coder->pos = 0; coder->todo_count = 0; coder->sequence = SEQ_EXTRA_ALLOC; |