From 20b4a4cb7c374d5d33f782855bb4b32ed3d0514d Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Sat, 31 May 2025 09:46:17 +0200 Subject: [PATCH] iso9660: Check another archive_string_ensure result Missed one unchecked archive_string_ensure in the previous commit. Signed-off-by: Tobias Stoeckmann --- libarchive/archive_write_set_format_iso9660.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index ac36bea31..c275c1ec9 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -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; -- 2.47.2