TINSEL: Don't use unsafe strcat and strcpy

This commit is contained in:
Le Philousophe 2022-10-02 19:10:02 +02:00 committed by Eugene Sandulenko
parent 422d8d98ae
commit 52caebf8af
2 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,7 @@ bool TinselFile::open(const Common::String &filename) {
// Form a filename without the CD number character
char newFilename[50];
strncpy(newFilename, fname, p - fname);
strcpy(newFilename + (p - fname), p + 1);
Common::strcpy_s(newFilename + (p - fname), sizeof(newFilename) - (p - fname), p + 1);
return openInternal(newFilename);
}

View File

@ -234,7 +234,7 @@ int LoadStringResource(int id, int sub, char *pBuffer, int bufferMax) {
byte *pText = FindStringBase(id);
if (pText == NULL) {
strcpy(pBuffer, "!! HIGH STRING !!");
Common::strcpy_s(pBuffer, bufferMax, "!! HIGH STRING !!");
return 0;
}
@ -310,7 +310,7 @@ int LoadStringResource(int id, int sub, char *pBuffer, int bufferMax) {
}
// TEMPORARY DIRTY BODGE
strcpy(pBuffer, "!! NULL STRING !!");
Common::strcpy_s(pBuffer, bufferMax, "!! NULL STRING !!");
// string does not exist
return 0;