aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-12 14:29:53 +0200
committerEugene Sandulenko2016-05-12 14:29:53 +0200
commitba8c9271cf548b9b578fa29b67c35db3fe652d06 (patch)
treec9465891615e578d716ec8d4204b72430c43cee9 /engines/agos
parent17832f2ab1abe0f6a8f6563879099242b816cd59 (diff)
downloadscummvm-rg350-ba8c9271cf548b9b578fa29b67c35db3fe652d06.tar.gz
scummvm-rg350-ba8c9271cf548b9b578fa29b67c35db3fe652d06.tar.bz2
scummvm-rg350-ba8c9271cf548b9b578fa29b67c35db3fe652d06.zip
AGOS: Safer string manipulation
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/string.cpp6
-rw-r--r--engines/agos/string_pn.cpp2
2 files changed, 4 insertions, 4 deletions
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);