diff options
author | Torbjörn Andersson | 2010-07-14 04:42:27 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2010-07-14 04:42:27 +0000 |
commit | 67601273002a43134d23202eed759c1691ea16dc (patch) | |
tree | 94e088117d883d01d45365ddd48fcd1b8d71e766 /engines/m4 | |
parent | 3cb59d237e85805eeab377ec8d571a76d83cd029 (diff) | |
download | scummvm-rg350-67601273002a43134d23202eed759c1691ea16dc.tar.gz scummvm-rg350-67601273002a43134d23202eed759c1691ea16dc.tar.bz2 scummvm-rg350-67601273002a43134d23202eed759c1691ea16dc.zip |
The new buffer has to be one byte longer than the length of the 'buffer'
string. (Error spotted by cppcheck.) Also, there's no need to use sprintf()
where a strcpy() will do just as well. (It's tempting, but probably not
appropriate, to use strdup(). I'm guessing the buffer *has* to be allocated
with 'new'.)
svn-id: r50872
Diffstat (limited to 'engines/m4')
-rw-r--r-- | engines/m4/converse.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 11bc165811..af26a86313 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -858,8 +858,8 @@ void Converse::loadConversationMads(const char *convName) { if (buffer[curPos - 1] == '\0') { // end of string //printf("%s\n", buffer); - buf = new char[strlen(buffer)]; - sprintf(buf, "%s", buffer); + buf = new char[strlen(buffer) + 1]; + strcpy(buf, buffer); _convStrings.push_back(buf); curPos = 0; *buffer = 0; |