From 1b2d1f1e0c1775997edc724fc367c18ac44878c3 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 29 Apr 2017 18:55:05 +0200 Subject: [PATCH] Avoid memcpy of zero length, the source can be NULL. --- libarchive/archive_read_support_format_iso9660.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index 76da4069e..f01d37bf6 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; -- 2.47.2