diff options
author | Bastien Bouclet | 2019-09-08 19:55:23 +0200 |
---|---|---|
committer | Bastien Bouclet | 2019-09-08 19:55:23 +0200 |
commit | 997e15878ad72e773ca3835b756daf02d0f7334d (patch) | |
tree | 4eed36f19ed89f2d99c64c0c259e91bdec7e5ac8 /engines/hdb/hdb.cpp | |
parent | 042e1964882d0d1387349f3a9d40d5aa7fe3399f (diff) | |
download | scummvm-rg350-997e15878ad72e773ca3835b756daf02d0f7334d.tar.gz scummvm-rg350-997e15878ad72e773ca3835b756daf02d0f7334d.tar.bz2 scummvm-rg350-997e15878ad72e773ca3835b756daf02d0f7334d.zip |
HDB: Fix out of bounds read in HDBGame::setInMapName
Diffstat (limited to 'engines/hdb/hdb.cpp')
-rw-r--r-- | engines/hdb/hdb.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 82e377df85..b7fdf304ba 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -849,7 +849,7 @@ void HDBGame::drawLoadingScreen() { struct MapName { const char *fName, *printName; -} mapNames[] = { +} static mapNames[] = { { "MAP00", "HDS Colby Jack" }, { "MAP01", "Servandrones, Inc." }, { "MAP02", "Pushbot Storage" }, @@ -884,15 +884,12 @@ struct MapName { }; void HDBGame::setInMapName(const char *name) { - int i = 0; - - while (mapNames[i].fName) { + for (uint i = 0; i < ARRAYSIZE(mapNames); i++) { if (!scumm_stricmp(name, mapNames[i].fName)) { memset(&_inMapName, 0, 32); strcpy(_inMapName, mapNames[i].printName); return; } - i++; } memset(&_inMapName, 0, 32); |