aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-05-08 21:25:18 +0000
committerJohannes Schickel2010-05-08 21:25:18 +0000
commitfef4060a22627a8d53ed1df837bd4ea53574bf98 (patch)
tree4e23f4826f8d437e97e916b0e2aa9ca5222ec719
parent9529dfa322409065bed36ba86dda260b70720187 (diff)
downloadscummvm-rg350-fef4060a22627a8d53ed1df837bd4ea53574bf98.tar.gz
scummvm-rg350-fef4060a22627a8d53ed1df837bd4ea53574bf98.tar.bz2
scummvm-rg350-fef4060a22627a8d53ed1df837bd4ea53574bf98.zip
Fix possible out of bounds access.
svn-id: r48972
-rw-r--r--tools/create_kyradat/create_kyradat.cpp8
-rw-r--r--tools/create_kyradat/extract.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp
index 1c690f050e..c1bcbc006c 100644
--- a/tools/create_kyradat/create_kyradat.cpp
+++ b/tools/create_kyradat/create_kyradat.cpp
@@ -329,7 +329,7 @@ const TypeTable gameTable[] = {
};
byte getGameID(int game) {
- return std::find(gameTable, gameTable + ARRAYSIZE(gameTable), game)->value;
+ return std::find(gameTable, gameTable + ARRAYSIZE(gameTable) - 1, game)->value;
}
const TypeTable languageTable[] = {
@@ -344,7 +344,7 @@ const TypeTable languageTable[] = {
};
byte getLanguageID(int lang) {
- return std::find(languageTable, languageTable + ARRAYSIZE(languageTable), lang)->value;
+ return std::find(languageTable, languageTable + ARRAYSIZE(languageTable) - 1, lang)->value;
}
const TypeTable platformTable[] = {
@@ -357,7 +357,7 @@ const TypeTable platformTable[] = {
};
byte getPlatformID(int platform) {
- return std::find(platformTable, platformTable + ARRAYSIZE(platformTable), platform)->value;
+ return std::find(platformTable, platformTable + ARRAYSIZE(platformTable) - 1, platform)->value;
}
const TypeTable specialTable[] = {
@@ -369,7 +369,7 @@ const TypeTable specialTable[] = {
};
byte getSpecialID(int special) {
- return std::find(specialTable, specialTable + ARRAYSIZE(specialTable), special)->value;
+ return std::find(specialTable, specialTable + ARRAYSIZE(specialTable) - 1, special)->value;
}
// filename processing
diff --git a/tools/create_kyradat/extract.cpp b/tools/create_kyradat/extract.cpp
index f47a3f649c..8286d1ca63 100644
--- a/tools/create_kyradat/extract.cpp
+++ b/tools/create_kyradat/extract.cpp
@@ -108,7 +108,7 @@ const TypeTable typeTable[] = {
{ kLolTypeSpellData, 9 },
{ kLolTypeCompassData, 10 },
{ kLolTypeFlightShpData, 11 },
- { -1, 0 }
+ { -1, 1 }
};
} // end of anonymous namespace
@@ -124,7 +124,7 @@ const ExtractType *findExtractType(const int type) {
}
byte getTypeID(int type) {
- return std::find(typeTable, typeTable + ARRAYSIZE(typeTable), type)->value;
+ return std::find(typeTable, typeTable + ARRAYSIZE(typeTable) - 1, type)->value;
}
// Extractor implementation