iso9660: support files without extension

This commit is contained in:
JlXip 2021-03-05 22:42:06 +01:00 committed by mintsuki
parent 443266feb3
commit 32a4539313
1 changed files with 9 additions and 0 deletions

View File

@ -142,6 +142,13 @@ static struct iso9660_directory_entry *iso9660_find(void *buffer, uint32_t size,
finalfile[len + 0] = ';';
finalfile[len + 1] = '1';
// Now, in case the file doesn't have extension
char finalfile_noext[len+3];
strcpy(finalfile_noext, filename);
finalfile_noext[len + 0] = '.';
finalfile_noext[len + 1] = ';';
finalfile_noext[len + 2] = '1';
while (size) {
struct iso9660_directory_entry *entry = buffer;
char* entry_filename = (char*)entry + sizeof(struct iso9660_directory_entry);
@ -152,6 +159,8 @@ static struct iso9660_directory_entry *iso9660_find(void *buffer, uint32_t size,
return buffer;
} else if (entry->filename_size == len+2 && !iso9660_strcmp(finalfile, entry_filename, len+2)) {
return buffer;
} else if (entry->filename_size == len+3 && !iso9660_strcmp(finalfile_noext, entry_filename, len+3)) {
return buffer;
} else {
size -= entry->length;
buffer += entry->length;