fs/iso9660: Fix multi-extent splicing on non-Rock-Ridge images

This commit is contained in:
Mintsuki
2026-04-18 00:20:18 +02:00
parent 1ca8be92b8
commit 47d0f207fb

View File

@@ -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;