]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Follow-on to change 141950: Enforce the non-zero minimum BEFORE
authorTim Kientzle <kientzle@gmail.com>
Wed, 21 May 2008 20:53:40 +0000 (16:53 -0400)
committerTim Kientzle <kientzle@gmail.com>
Wed, 21 May 2008 20:53:40 +0000 (16:53 -0400)
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

index c10870495c085f884711bd21a4b9fa4dd79a3e5c..e0825a36e1a0deb6a191a31a11899f3884b4ca8f 100644 (file)
@@ -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");