aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/file/base_disk_file.cpp
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-24 18:49:01 +0200
committerEinar Johan Trøan Sømåen2012-07-24 18:49:01 +0200
commitc59965ad4faca67be0dad554bc291a97f2691dff (patch)
treef8c416d9d3cdbb61bb930ec9e88826f8e9dc96cf /engines/wintermute/base/file/base_disk_file.cpp
parentec7362d13e8edc4ccf64ee004592cb10db8bc6f4 (diff)
downloadscummvm-rg350-c59965ad4faca67be0dad554bc291a97f2691dff.tar.gz
scummvm-rg350-c59965ad4faca67be0dad554bc291a97f2691dff.tar.bz2
scummvm-rg350-c59965ad4faca67be0dad554bc291a97f2691dff.zip
WINTERMUTE: Make sure we don't skip path-components.
Diffstat (limited to 'engines/wintermute/base/file/base_disk_file.cpp')
-rw-r--r--engines/wintermute/base/file/base_disk_file.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 09a83f5768..c03a9b61e7 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -69,14 +69,19 @@ static Common::FSNode getNodeForRelativePath(const Common::String& filename) {
Common::String pathPart = path.nextToken();
// Get the next FSNode in the chain, if it exists as a child from the previous.
Common::FSNode nextNode(curNode.getChild(pathPart));
+ if (!nextNode.exists()) {
+ // Return an invalid FSNode.
+ return Common::FSNode();
+ }
if (nextNode.exists() && nextNode.isReadable()) {
curNode = nextNode;
}
// Following the comments in common/fs.h, anything not a directory is a file.
if (!curNode.isDirectory()) {
- assert(path.empty());
+ if (!path.empty()) {
+ error("Relative path %s reached a file before the end of the path", filename.c_str());
+ }
return curNode;
- break;
}
}
}