mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
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:
parent
bd63ee2c4e
commit
ff4c060be1
@ -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;
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user