mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 19:45:41 -04:00
[libromdata] IsoPartitionPrivate::getDirectory(): Fail if the entry isn't a directory.
Otherwise, it might try to load the file data as if it's a directory, which would result in weird shenanigans.
This commit is contained in:
parent
988df314e6
commit
c65ea8c0ed
@ -444,7 +444,7 @@ const IsoPartitionPrivate::DirData_t *IsoPartitionPrivate::getDirectory(const ch
|
||||
|
||||
if (!pDir) {
|
||||
// Can't find the parent directory.
|
||||
// getDirectory() already set q->lastError().
|
||||
// getDirectory() already set q->m_lastError().
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -452,7 +452,11 @@ const IsoPartitionPrivate::DirData_t *IsoPartitionPrivate::getDirectory(const ch
|
||||
const ISO_DirEntry *const entry = lookup_int(pDir, path, true);
|
||||
if (!entry) {
|
||||
// Not found.
|
||||
// lookup_int() already set q->lastError().
|
||||
// lookup_int() already set q->m_lastError().
|
||||
return nullptr;
|
||||
} else if (!(entry->flags & ISO_FLAG_DIRECTORY)) {
|
||||
// Entry found, but it's a directory.
|
||||
q->m_lastError = ENOTDIR;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -515,7 +519,7 @@ const ISO_DirEntry *IsoPartitionPrivate::lookup(const char *filename)
|
||||
|
||||
if (!pDir) {
|
||||
// Error getting the directory.
|
||||
// getDirectory() has already set q->lastError.
|
||||
// getDirectory() has already set q->m_lastError.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user