diff options
author | Torbjörn Andersson | 2006-04-02 18:58:07 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-04-02 18:58:07 +0000 |
commit | 80b3f9217dcb853220e972f83ea210ede8623fe3 (patch) | |
tree | 575b321807bf806ce7f5e7317287272ac2cc5000 /engines | |
parent | 36867335954bdbbdc82fe79a1bea6c1e58de62d5 (diff) | |
download | scummvm-rg350-80b3f9217dcb853220e972f83ea210ede8623fe3.tar.gz scummvm-rg350-80b3f9217dcb853220e972f83ea210ede8623fe3.tar.bz2 scummvm-rg350-80b3f9217dcb853220e972f83ea210ede8623fe3.zip |
Don't try to copy str to _talkBuffer if str is pointing to _talkBuffer. Apart
from being unnecessary, the result of strcpy() on overlapping memory areas is
unpredictable.
svn-id: r21562
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/text.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index 61073b5cfc..c8c4657a36 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -420,8 +420,10 @@ int TextDisplayer::dropCRIntoString(char *str, int offs) { char *TextDisplayer::preprocessString(const char *str) { debugC(9, kDebugLevelMain, "TextDisplayer::preprocessString('%s')", str); - assert(strlen(str) < sizeof(_talkBuffer) - 1); - strcpy(_talkBuffer, str); + if (str != _talkBuffer) { + assert(strlen(str) < sizeof(_talkBuffer) - 1); + strcpy(_talkBuffer, str); + } char *p = _talkBuffer; while (*p) { if (*p == '\r') { |