From ba8c9271cf548b9b578fa29b67c35db3fe652d06 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 12 May 2016 14:29:53 +0200 Subject: AGOS: Safer string manipulation --- engines/agos/string.cpp | 6 +++--- engines/agos/string_pn.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 4f6c62c48a..cc443f2f50 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -126,14 +126,14 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) { _awaitTwoByteToken = 0; uncompressText(ptr); _textBuffer[_textCount] = 0; - strcpy((char *)dst, (const char *)_textBuffer); + Common::strlcpy((char *)dst, (const char *)_textBuffer, 180); } else { if (stringId < 0x8000) { stringPtr = _stringTabPtr[stringId]; } else { stringPtr = getLocalStringByID(stringId); } - strcpy((char *)dst, (const char *)stringPtr); + Common::strlcpy((char *)dst, (const char *)stringPtr, 180); } // WORKAROUND bug #1538873: The French version of Simon 1 and the @@ -796,7 +796,7 @@ void AGOSEngine_Feeble::printInteractText(uint16 num, const char *string) { if (*string2 == 0x00) { if (w == 0xFFFF) w = pixels; - strcpy(convertedString2, string); + Common::strlcpy(convertedString2, string, 320); break; } while (*string2 != ' ') { diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp index 7a364f3ea9..06c8bbd98e 100644 --- a/engines/agos/string_pn.cpp +++ b/engines/agos/string_pn.cpp @@ -114,7 +114,7 @@ void AGOSEngine_PN::getObjectName(char *v, uint16 x) { } void AGOSEngine_PN::pcl(const char *s) { - strcat(_sb, s); + Common::strlcat(_sb, s, 80); if (strchr(s, '\n') == 0) { for (char *str = _sb; *str; str++) windowPutChar(_windowArray[_curWindow], *str); -- cgit v1.2.3