TINSEL: Safer string manipulation
This commit is contained in:
parent
775b615fdd
commit
a57aa55999
5 changed files with 9 additions and 9 deletions
|
@ -567,8 +567,8 @@ void BMVPlayer::PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape) {
|
|||
|
||||
assert(!bMovieOn);
|
||||
|
||||
strcpy(szMovieFile, (char *)LockMem(hFileStem));
|
||||
strcat(szMovieFile, BMOVIE_EXTENSION);
|
||||
Common::strlcpy(szMovieFile, (char *)LockMem(hFileStem), 14);
|
||||
Common::strlcat(szMovieFile, BMOVIE_EXTENSION, 14);
|
||||
|
||||
assert(strlen(szMovieFile) <= 12);
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile
|
|||
for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
|
||||
// Get the next filename, stripping off any '1' suffix character
|
||||
char tempFilename[50];
|
||||
strcpy(tempFilename, fileDesc->fileName);
|
||||
Common::strlcpy(tempFilename, fileDesc->fileName, 50);
|
||||
char *pOne = strchr(tempFilename, '1');
|
||||
if (pOne) {
|
||||
do {
|
||||
|
@ -275,7 +275,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile
|
|||
for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
|
||||
// Get the next filename, stripping off any '1' suffix character
|
||||
char tempFilename[50];
|
||||
strcpy(tempFilename, fileDesc->fileName);
|
||||
Common::strlcpy(tempFilename, fileDesc->fileName, 50);
|
||||
char *pOne = strchr(tempFilename, '1');
|
||||
if (pOne) {
|
||||
do {
|
||||
|
|
|
@ -1671,10 +1671,10 @@ static void Select(int i, bool force) {
|
|||
#else
|
||||
// Current description with cursor appended
|
||||
if (cd.box[i].boxText != NULL) {
|
||||
strcpy(g_sedit, cd.box[i].boxText);
|
||||
strcat(g_sedit, sCursor);
|
||||
Common::strlcpy(g_sedit, cd.box[i].boxText, SG_DESC_LEN+2);
|
||||
Common::strlcat(g_sedit, sCursor, SG_DESC_LEN+2);
|
||||
} else {
|
||||
strcpy(g_sedit, sCursor);
|
||||
Common::strlcpy(g_sedit, sCursor, SG_DESC_LEN+2);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ void LoadExtraGraphData(SCNHANDLE start, SCNHANDLE next) {
|
|||
}
|
||||
|
||||
void SetCdPlaySceneDetails(int fileNum, const char *fileName) {
|
||||
strcpy(g_szCdPlayFile, fileName);
|
||||
Common::strlcpy(g_szCdPlayFile, fileName, 100);
|
||||
}
|
||||
|
||||
void SetCdPlayHandle(int fileNum) {
|
||||
|
|
|
@ -563,7 +563,7 @@ static void DoSave() {
|
|||
|
||||
while (1) {
|
||||
Common::String fname = _vm->getSavegameFilename(ano);
|
||||
strcpy(tmpName, fname.c_str());
|
||||
Common::strlcpy(tmpName, fname.c_str(), FNAMELEN);
|
||||
|
||||
for (i = 0; i < g_numSfiles; i++)
|
||||
if (!strcmp(g_savedFiles[i].name, tmpName))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue