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.
This commit is contained in:
Johannes Schickel 2014-06-09 22:45:25 +02:00
parent bd63ee2c4e
commit ff4c060be1
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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++;
}