fs/iso9660: Fix multi-extent splicing on non-Rock-Ridge images
diff --git a/common/fs/iso9660.s2.c b/common/fs/iso9660.s2.c
index 2800f708..fd63d676 100644
--- a/common/fs/iso9660.s2.c
+++ b/common/fs/iso9660.s2.c
@@ -425,10 +425,11 @@ struct file_handle *iso9660_open(struct volume *vol, const char *path) {
uint64_t total_size = entry->extent_size.little;
struct iso9660_directory_entry *e = entry;
+ // load_name returns false on the ISO-9660 fallback path but
+ // still populates the buffer; treat an empty buffer as the only
+ // "no usable name" case.
char base_name[256];
- if (!load_name(base_name, sizeof(base_name), entry)) {
- base_name[0] = '\0';
- }
+ load_name(base_name, sizeof(base_name), entry);
while (e->flags & ISO9660_FLAG_MULTI_EXTENT) {
struct iso9660_directory_entry *next = iso9660_next_entry(e, buffer_end);
@@ -438,8 +439,8 @@ struct file_handle *iso9660_open(struct volume *vol, const char *path) {
// the file identifier of the first record. Refuse to splice
// in unrelated entries.
char next_name[256];
- if (!load_name(next_name, sizeof(next_name), next)
- || strcmp(base_name, next_name) != 0) {
+ load_name(next_name, sizeof(next_name), next);
+ if (base_name[0] == '\0' || strcmp(base_name, next_name) != 0) {
break;
}
e = next;
