]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Avoid memcpy of zero length, the source can be NULL.
authorJoerg Sonnenberger <joerg@bec.de>
Sat, 29 Apr 2017 16:55:05 +0000 (18:55 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Sat, 29 Apr 2017 16:55:05 +0000 (18:55 +0200)
libarchive/archive_read_support_format_iso9660.c

index 76da4069ef136424e93d60d88cc0fe3f726d14b9..f01d37bf682e2832120dba1f6c5ca15b85429eb3 100644 (file)
@@ -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;