[Scummvm-cvs-logs] scummvm master -> ff4c060be1c7c5a966fc432b0bf045f796892728
lordhoto
lordhoto at gmail.com
Mon Jun 9 22:50:08 CEST 2014
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ff4c060be1 FULLPIPE: Use strlcpy instead of strncpy in some places.
Commit: ff4c060be1c7c5a966fc432b0bf045f796892728
https://github.com/scummvm/scummvm/commit/ff4c060be1c7c5a966fc432b0bf045f796892728
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-06-09T22:46:54+02:00
Commit Message:
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.
Changed paths:
engines/fullpipe/modal.cpp
engines/fullpipe/sound.cpp
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 3dbbeb7..6f99200 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 53ed52a..8e49954 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++;
}
More information about the Scummvm-git-logs
mailing list