From 7a38f978941a98405cadbc9553768c72aa274e36 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Wed, 21 May 2008 16:53:40 -0400 Subject: [PATCH] Follow-on to change 141950: Enforce the non-zero minimum BEFORE checking to ensure that the buffer really is larger. Otherwise, doubling zero gives us zero. Pointy hat: /me SVN-Revision: 85 --- libarchive/archive_read_support_format_iso9660.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index c10870495..e0825a36e 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -595,11 +595,11 @@ add_entry(struct iso9660 *iso9660, struct file_info *file) struct file_info **new_pending_files; int new_size = iso9660->pending_files_allocated * 2; + if (iso9660->pending_files_allocated < 1024) + new_size = 1024; /* Overflow might keep us from growing the list. */ if (new_size <= iso9660->pending_files_allocated) __archive_errx(1, "Out of memory"); - if (new_size < 1024) - new_size = 1024; new_pending_files = (struct file_info **)malloc(new_size * sizeof(new_pending_files[0])); if (new_pending_files == NULL) __archive_errx(1, "Out of memory"); -- 2.47.3