From: Tim Kientzle Date: Wed, 21 May 2008 20:53:40 +0000 (-0400) Subject: Follow-on to change 141950: Enforce the non-zero minimum BEFORE X-Git-Tag: v2.6.0~207 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a38f978941a98405cadbc9553768c72aa274e36;p=thirdparty%2Flibarchive.git 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 --- 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");