aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-09-06 16:19:01 -0500
committerColin Snover2017-09-08 16:02:32 -0500
commitd97f192f45f553a0900b3f6e35af7dc4fb982dfe (patch)
tree0d8bc2182006cfa081e6ffe1647542497fdb9824 /engines
parentd98d4bc25d750c1e27d21920fb5214cdbb71a961 (diff)
downloadscummvm-rg350-d97f192f45f553a0900b3f6e35af7dc4fb982dfe.tar.gz
scummvm-rg350-d97f192f45f553a0900b3f6e35af7dc4fb982dfe.tar.bz2
scummvm-rg350-d97f192f45f553a0900b3f6e35af7dc4fb982dfe.zip
SCI: Improve array bounds safety check
There is no practical risk now since the enum and array sizes are the same, but there is no reason to rely on a separate data structure to avoid potential out-of-bounds index use here instead of just checking the array size directly, which is always safe.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/resource.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index ee0f38934d..f64d3acdab 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -141,7 +141,7 @@ static const char *const s_resourceTypeSuffixes[] = {
};
const char *getResourceTypeName(ResourceType restype) {
- if (restype != kResourceTypeInvalid)
+ if (restype < ARRAYSIZE(s_resourceTypeNames))
return s_resourceTypeNames[restype];
else
return "invalid";