fs/iso9660: Verify directory flag before descending into subdirectory

This commit is contained in:
Mintsuki
2026-04-17 02:19:38 +02:00
parent 4744bdbd27
commit 03ad4a421c

View File

@@ -25,6 +25,7 @@ struct iso9660_file_handle {
struct iso9660_extent *extents;
};
#define ISO9660_FLAG_DIRECTORY 0x02
#define ISO9660_FLAG_MULTI_EXTENT 0x80
#define ISO9660_FIRST_VOLUME_DESCRIPTOR 0x10
@@ -407,6 +408,14 @@ struct file_handle *iso9660_open(struct volume *vol, const char *path) {
next_sector = entry->extent.little;
next_size = entry->extent_size.little;
if (*path != '\0' && !(entry->flags & ISO9660_FLAG_DIRECTORY)) {
if (!first) {
pmm_free(current, current_size);
}
pmm_free(ret, sizeof(struct iso9660_file_handle));
return NULL;
}
if (*path == '\0') {
// Found the file - collect all extents for multi-extent files
void *buffer_end = (uint8_t *)current + current_size;