diff options
Diffstat (limited to 'src/Common/libzip/zip_source_buffer.c')
-rw-r--r-- | src/Common/libzip/zip_source_buffer.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Common/libzip/zip_source_buffer.c b/src/Common/libzip/zip_source_buffer.c index 119bc02c..0685fb39 100644 --- a/src/Common/libzip/zip_source_buffer.c +++ b/src/Common/libzip/zip_source_buffer.c @@ -1,6 +1,6 @@ /* zip_source_buffer.c -- create zip data source from buffer - Copyright (C) 1999-2018 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -93,9 +93,13 @@ ZIP_EXTERN zip_source_t * zip_source_buffer_create(const void *data, zip_uint64_t len, int freep, zip_error_t *error) { zip_buffer_fragment_t fragment; - if (data == NULL && len > 0) { - zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; + if (data == NULL) { + if (len > 0) { + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; + } + + return zip_source_buffer_fragment_create(NULL, 0, freep, error); } fragment.data = (zip_uint8_t *)data; @@ -457,7 +461,7 @@ buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int } buffer->nfragments = j; buffer->first_owned_fragment = free_data ? 0 : buffer->nfragments; - buffer->fragment_offsets[nfragments] = offset; + buffer->fragment_offsets[buffer->nfragments] = offset; buffer->size = offset; } |