aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2013-08-23 12:19:58 +0200
committerTorbjörn Andersson2013-08-23 12:19:58 +0200
commit91d35cec1a76e2f617666ca4850d9ad64c65020f (patch)
tree6b4fd721c9101fcb29a4241a63a651b5c8f8a248
parenta5057db3ea4650bc898925fcd96e3a25ac97d736 (diff)
downloadscummvm-rg350-91d35cec1a76e2f617666ca4850d9ad64c65020f.tar.gz
scummvm-rg350-91d35cec1a76e2f617666ca4850d9ad64c65020f.tar.bz2
scummvm-rg350-91d35cec1a76e2f617666ca4850d9ad64c65020f.zip
AGOS: Use strncpy() instead of strcpy(). CID 1003679, 1003681
-rw-r--r--engines/agos/script_pn.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 60a1376f25..61dce0b399 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -381,7 +381,8 @@ void AGOSEngine_PN::opn_opcode31() {
case 0:
getFilename();
slot = matchSaveGame(_saveFile, countSaveGames());
- strcpy(bf, genSaveName(slot));
+ strncpy(bf, genSaveName(slot), sizeof(bf));
+ bf[sizeof(bf) - 1] = 0;
break;
case 1:
strcpy(bf, "pn.sav");
@@ -419,9 +420,10 @@ void AGOSEngine_PN::opn_opcode32() {
getFilename();
slot = matchSaveGame(_saveFile, curSlot);
if (slot != -1)
- strcpy(bf, genSaveName(slot));
+ strncpy(bf, genSaveName(slot), sizeof(bf));
else
- strcpy(bf, genSaveName(curSlot));
+ strncpy(bf, genSaveName(curSlot), sizeof(bf));
+ bf[sizeof(bf) - 1] = 0;
break;
case 1:
strcpy(bf, "pn.sav");