aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-30 14:22:22 +0000
committerMartin Kiewitz2009-10-30 14:22:22 +0000
commit3ec76350ec48f41850c9e65815427f5e334e0f66 (patch)
tree8085fe928e77ffcc1ab9c23bc61aa3884496826a /engines
parentff284c9f5bea8a9eaeadf0328230cfc72ab2f96c (diff)
downloadscummvm-rg350-3ec76350ec48f41850c9e65815427f5e334e0f66.tar.gz
scummvm-rg350-3ec76350ec48f41850c9e65815427f5e334e0f66.tar.bz2
scummvm-rg350-3ec76350ec48f41850c9e65815427f5e334e0f66.zip
SCI: kStrAt offset checking fixed
svn-id: r45537
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kstring.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index db218f5097..b09b34c435 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -308,12 +308,14 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
if (argc > 2)
newvalue = argv[2].toSint16();
+ // in kq5 this here gets called with offset 0xFFFF
+ // (in the desert wheng getting the staff)
+ if ((int)offset >= dest_r.maxSize) {
+ warning("kStrAt offset %X exceeds maxSize", offset);
+ return s->r_acc;
+ }
+
if (dest_r.isRaw) {
- // in kq5 this here gets called with offset 0xFFFF
- if ((int)offset > dest_r.maxSize) {
- warning("kStrAt offset %X exceeds maxSize", offset);
- return s->r_acc;
- }
value = dest_r.raw[offset];
if (argc > 2) /* Request to modify this char */
dest_r.raw[offset] = newvalue;