From: Joerg Sonnenberger Date: Sat, 29 Apr 2017 16:55:05 +0000 (+0200) Subject: Avoid memcpy of zero length, the source can be NULL. X-Git-Tag: v3.3.2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b2d1f1e0c1775997edc724fc367c18ac44878c3;p=thirdparty%2Flibarchive.git Avoid memcpy of zero length, the source can be NULL. --- 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;