aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-03-07 13:40:00 +0000
committerWillem Jan Palenstijn2009-03-07 13:40:00 +0000
commit7a88744b749e45efa8fb7339cf0989c5572f3863 (patch)
tree133d398f3952e2aa2069d49e783c5528fe0a8112
parent32e49fe2cf9c9fc1036b583dd39b8e2c351f81b4 (diff)
downloadscummvm-rg350-7a88744b749e45efa8fb7339cf0989c5572f3863.tar.gz
scummvm-rg350-7a88744b749e45efa8fb7339cf0989c5572f3863.tar.bz2
scummvm-rg350-7a88744b749e45efa8fb7339cf0989c5572f3863.zip
Patch #2671477: Fix wrong usage of strncat
svn-id: r39184
-rw-r--r--engines/saga/sfuncs.cpp4
-rw-r--r--engines/scumm/he/logic_he.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index a274983de1..9d298818cd 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -1570,9 +1570,9 @@ void Script::sfStub(const char *name, ScriptThread *thread, int nArgs) {
for (int i = 0; i < nArgs; i++) {
snprintf(buf1, 100, "%d", thread->pop());
- strncat(buf, buf1, 256);
+ strncat(buf, buf1, sizeof(buf) - strlen(buf) - 1);
if (i + 1 < nArgs)
- strncat(buf, ", ", 256);
+ strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
}
debug(0, "%s)", buf);
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index f7f4c1effc..9efb1c697c 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -86,9 +86,9 @@ int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
for (int i = 1; i < numArgs; i++) {
snprintf(tmp, 32, ", %d", args[i]);
- strncat(str, tmp, 256);
+ strncat(str, tmp, sizeof(str) - strlen(str) - 1);
}
- strncat(str, "])", 256);
+ strncat(str, "])", sizeof(str) - strlen(str) - 1);
debug(0, "%s", str);
#else