aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2014-06-09 22:45:25 +0200
committerJohannes Schickel2014-06-09 22:46:54 +0200
commitff4c060be1c7c5a966fc432b0bf045f796892728 (patch)
treed87091429deda97f25ab3f21c43ee858a523da15
parentbd63ee2c4e6b5352cd28fa06f73135f0c9c5eb96 (diff)
downloadscummvm-rg350-ff4c060be1c7c5a966fc432b0bf045f796892728.tar.gz
scummvm-rg350-ff4c060be1c7c5a966fc432b0bf045f796892728.tar.bz2
scummvm-rg350-ff4c060be1c7c5a966fc432b0bf045f796892728.zip
FULLPIPE: Use strlcpy instead of strncpy in some places.
strncpy does not assure that the result is 0 terminated. strlcpy does, which makes this safer. I only replaced strncpy usages where the memory was not allocated to the correct size right before the strncpy usage.
-rw-r--r--engines/fullpipe/modal.cpp2
-rw-r--r--engines/fullpipe/sound.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 3dbbeb78c4..6f99200529 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -1596,7 +1596,7 @@ void ModalSaveGame::setup(Scene *sc, int mode) {
fileinfo = new FileInfo;
memset(fileinfo, 0, sizeof(FileInfo));
- strncpy(fileinfo->filename, getSavegameFile(i), 160);
+ Common::strlcpy(fileinfo->filename, getSavegameFile(i), 160);
if (!getFileInfo(i, fileinfo)) {
fileinfo->empty = true;
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 53ed52a44b..8e49954bc6 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -268,7 +268,7 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
while (sub) {
if (_musicAllowed & sub->_value.intValue) {
- strncpy(_sceneTracks[_numSceneTracks], sub->_varName, 260);
+ Common::strlcpy(_sceneTracks[_numSceneTracks], sub->_varName, 260);
_numSceneTracks++;
}
@@ -432,7 +432,7 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed
while (sub) {
if (_musicAllowed & sub->_value.intValue) {
- strncpy(_sceneTracks[_numSceneTracks], sub->_varName, 260);
+ Common::strlcpy(_sceneTracks[_numSceneTracks], sub->_varName, 260);
_numSceneTracks++;
}