diff options
author | Martin Kiewitz | 2009-10-30 14:22:22 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-30 14:22:22 +0000 |
commit | 3ec76350ec48f41850c9e65815427f5e334e0f66 (patch) | |
tree | 8085fe928e77ffcc1ab9c23bc61aa3884496826a /engines/sci | |
parent | ff284c9f5bea8a9eaeadf0328230cfc72ab2f96c (diff) | |
download | scummvm-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/sci')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 12 |
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; |