diff options
author | uruk | 2014-08-13 19:49:56 +0200 |
---|---|---|
committer | uruk | 2014-08-13 19:49:56 +0200 |
commit | 8e22ef9b6d587113e3cd47c33cc0d344832da632 (patch) | |
tree | f71762963198d9a660ac6d8e52773457f81e72b5 | |
parent | 8b1ffab95bd1055bc73e3a0df0a59d994d5acd63 (diff) | |
download | scummvm-rg350-8e22ef9b6d587113e3cd47c33cc0d344832da632.tar.gz scummvm-rg350-8e22ef9b6d587113e3cd47c33cc0d344832da632.tar.bz2 scummvm-rg350-8e22ef9b6d587113e3cd47c33cc0d344832da632.zip |
CGE2: Fix possible string overflow in Hero::expand().
-rw-r--r-- | engines/cge2/hero.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 82363860aa..945bf483bc 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -190,14 +190,15 @@ Sprite *Hero::expand() { setShapeList(_dim[0], shpcnt); } - Common::String str(_vm->_text->getText(_ref + 100)); - char text[kLineMax + 1]; - strcpy(text, str.c_str()); + char *tempStr = _vm->_text->getText(_ref + 100); + char *text = new char[strlen(tempStr) + 1]; + strcpy(text, tempStr); _reachStart = atoi(_vm->token(text)); _reachCycle = atoi(_vm->token(nullptr)); _sayStart = atoi(_vm->token(nullptr)); _funStart = atoi(_vm->token(nullptr)); _funDel = _funDel0 = (72 / _ext->_seq[0]._dly) * atoi(_vm->token(nullptr)); + delete[] text; int i = stepSize() / 2; _maxDist = sqrt(double(i * i * 2)); |