SCUMM: Fix deepcode warning

- use memcpy() instead of strcpy() to insert linebreak character
This commit is contained in:
wonst719 2020-11-06 20:25:42 +09:00 committed by Eugene Sandulenko
parent 145617ce69
commit 1a0c320616

View File

@ -542,7 +542,6 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
int lastKoreanLineBreak = -1;
char tmpStrBuf[512];
int origPos = pos;
int lastspace = -1;
int curw = 1;
@ -550,6 +549,8 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
int oldID = getCurID();
int code = (_vm->_game.heversion >= 80) ? 127 : 64;
int strLength = _vm->resStrLen(str);
while ((chr = str[pos++]) != 0) {
if (_vm->_game.heversion >= 72) {
if (chr == code) {
@ -658,8 +659,8 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
lastspace = -1;
lastKoreanLineBreak = -1;
} else {
strcpy(tmpStrBuf, (char*)(str + lastKoreanLineBreak));
strcpy((char*)(str + lastKoreanLineBreak + 1), tmpStrBuf);
byte* breakPtr = str + lastKoreanLineBreak;
memmove(breakPtr + 1, breakPtr, strLength - lastKoreanLineBreak + 1);
str[lastKoreanLineBreak] = 0xD;
curw = 1;
pos = lastKoreanLineBreak + 1;