]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
iso9660: Check another archive_string_ensure result
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 31 May 2025 07:46:17 +0000 (09:46 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 31 May 2025 07:46:17 +0000 (09:46 +0200)
Missed one unchecked archive_string_ensure in the previous commit.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_write_set_format_iso9660.c

index ac36bea31e89985420bd51878ce28958dd58c392..c275c1ec92b96c67d5550d882e9d724dbce2a16c 100644 (file)
@@ -5671,9 +5671,15 @@ isoent_tree(struct archive_write *a, struct isoent **isoentpp)
                 * inserted. */
                iso9660->cur_dirent = dent;
                archive_string_empty(&(iso9660->cur_dirstr));
-               archive_string_ensure(&(iso9660->cur_dirstr),
+               if (archive_string_ensure(&(iso9660->cur_dirstr),
                    archive_strlen(&(dent->file->parentdir)) +
-                   archive_strlen(&(dent->file->basename)) + 2);
+                   archive_strlen(&(dent->file->basename)) + 2) == NULL) {
+                       archive_set_error(&a->archive, ENOMEM,
+                           "Can't allocate memory");
+                       _isoent_free(isoent);
+                       *isoentpp = NULL;
+                       return (ARCHIVE_FATAL);
+               }
                if (archive_strlen(&(dent->file->parentdir)) +
                    archive_strlen(&(dent->file->basename)) == 0)
                        iso9660->cur_dirstr.s[0] = 0;