summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_iso9660.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2017-04-29 18:55:05 +0200
committerJoerg Sonnenberger <joerg@bec.de>2017-04-29 18:55:05 +0200
commit1b2d1f1e0c1775997edc724fc367c18ac44878c3 (patch)
tree9cd303954785685dd44127abea4961342b2e7f1d /libarchive/archive_read_support_format_iso9660.c
parentb9a3b070d3bb7731e2aad8a448e6e7f3938dcdf3 (diff)
downloadlibarchive-1b2d1f1e0c1775997edc724fc367c18ac44878c3.tar.gz
Avoid memcpy of zero length, the source can be NULL.
Diffstat (limited to 'libarchive/archive_read_support_format_iso9660.c')
-rw-r--r--libarchive/archive_read_support_format_iso9660.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c
index 76da4069..f01d37bf 100644
--- a/libarchive/archive_read_support_format_iso9660.c
+++ b/libarchive/archive_read_support_format_iso9660.c
@@ -3021,8 +3021,9 @@ heap_add_entry(struct archive_read *a, struct heap_queue *heap,
ENOMEM, "Out of memory");
return (ARCHIVE_FATAL);
}
- memcpy(new_pending_files, heap->files,
- heap->allocated * sizeof(new_pending_files[0]));
+ if (heap->allocated)
+ memcpy(new_pending_files, heap->files,
+ heap->allocated * sizeof(new_pending_files[0]));
if (heap->files != NULL)
free(heap->files);
heap->files = new_pending_files;