aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/magnetic/detection.cpp
diff options
context:
space:
mode:
authorThierry Crozat2018-12-28 21:13:40 +0100
committerThierry Crozat2018-12-28 21:13:40 +0100
commit7c7cb6c836ad901b31849782238cd9226dc651ec (patch)
tree835b1973a39207ac166eb2b9e679fa227bce2e5a /engines/glk/magnetic/detection.cpp
parent287f40358e0cf43335b2727d4e2c5573d4c89246 (diff)
downloadscummvm-rg350-7c7cb6c836ad901b31849782238cd9226dc651ec.tar.gz
scummvm-rg350-7c7cb6c836ad901b31849782238cd9226dc651ec.tar.bz2
scummvm-rg350-7c7cb6c836ad901b31849782238cd9226dc651ec.zip
GLK: Fix out of bound access in detection code
This caused some random asserts when for example trying to add any game as Common::Str::hasSuffixIgnoreCase could be called with a null pointer.
Diffstat (limited to 'engines/glk/magnetic/detection.cpp')
-rw-r--r--engines/glk/magnetic/detection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
index 279f509a39..91d63ccace 100644
--- a/engines/glk/magnetic/detection.cpp
+++ b/engines/glk/magnetic/detection.cpp
@@ -46,7 +46,7 @@ MagneticDescriptor MagneticMetaEngine::findGame(const char *gameId) {
}
bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[3] = { ".magnetic" };
+ const char *const EXTENSIONS[1] = { ".magnetic" };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,7 +55,7 @@ bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 3 && !hasExt; ++idx)
+ for (int idx = 0; idx < 1 && !hasExt; ++idx)
hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
if (!hasExt)
continue;