aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/text.cpp
diff options
context:
space:
mode:
authorStrangerke2013-11-10 09:57:42 +0100
committerStrangerke2013-11-10 09:57:42 +0100
commit2f333f997ba42c44fd76cefeeb1912e2548532b3 (patch)
treeec477f5fda6500f19dabda8edf0bf4e300906d57 /engines/cge/text.cpp
parent06f9a5265a5dd20c548f8ba3293099ce3df5edb9 (diff)
downloadscummvm-rg350-2f333f997ba42c44fd76cefeeb1912e2548532b3.tar.gz
scummvm-rg350-2f333f997ba42c44fd76cefeeb1912e2548532b3.tar.bz2
scummvm-rg350-2f333f997ba42c44fd76cefeeb1912e2548532b3.zip
CGE: Ensure string copy don't overrun. Fix CID 1003674 to 1003678
Diffstat (limited to 'engines/cge/text.cpp')
-rw-r--r--engines/cge/text.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 27bb0608fd..08ff005e1e 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -69,7 +69,7 @@ int16 Text::count() {
for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
char *s;
assert(line.size() <= 513);
- strcpy(tmpStr, line.c_str());
+ Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
if (!Common::isDigit(*s))
@@ -101,8 +101,7 @@ void Text::load() {
for (idx = 0, line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
int n = line.size();
char *s;
- assert(n <= 513);
- strcpy(tmpStr, line.c_str());
+ Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
if (!Common::isDigit(*s))