Skip to content

Commit 47d0f20

Browse files
committed
fs/iso9660: Fix multi-extent splicing on non-Rock-Ridge images
1 parent 1ca8be9 commit 47d0f20

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

common/fs/iso9660.s2.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,11 @@ struct file_handle *iso9660_open(struct volume *vol, const char *path) {
425425
uint64_t total_size = entry->extent_size.little;
426426
struct iso9660_directory_entry *e = entry;
427427

428+
// load_name returns false on the ISO-9660 fallback path but
429+
// still populates the buffer; treat an empty buffer as the only
430+
// "no usable name" case.
428431
char base_name[256];
429-
if (!load_name(base_name, sizeof(base_name), entry)) {
430-
base_name[0] = '\0';
431-
}
432+
load_name(base_name, sizeof(base_name), entry);
432433

433434
while (e->flags & ISO9660_FLAG_MULTI_EXTENT) {
434435
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) {
438439
// the file identifier of the first record. Refuse to splice
439440
// in unrelated entries.
440441
char next_name[256];
441-
if (!load_name(next_name, sizeof(next_name), next)
442-
|| strcmp(base_name, next_name) != 0) {
442+
load_name(next_name, sizeof(next_name), next);
443+
if (base_name[0] == '\0' || strcmp(base_name, next_name) != 0) {
443444
break;
444445
}
445446
e = next;

0 commit comments

Comments
 (0)