AMIGAOS: Don't use unsafe strcat and strcpy

This commit is contained in:
Le Philousophe 2022-10-02 20:49:05 +02:00 committed by Eugene Sandulenko
parent 523ed4a34d
commit 5a0e4ced67
2 changed files with 5 additions and 4 deletions

View file

@ -41,7 +41,7 @@ struct Library *AslBase;
Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String &title, Common::FSNode &choice, bool isDirBrowser) { Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String &title, Common::FSNode &choice, bool isDirBrowser) {
char pathBuffer[MAXPATHLEN]; char pathBuffer[MAXPATHLEN];
strcpy(pathBuffer, "SYS:"); Common::strcpy_s(pathBuffer, "SYS:");
Common::String newTitle = title.encode(Common::kISO8859_1); Common::String newTitle = title.encode(Common::kISO8859_1);

View file

@ -314,9 +314,10 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN); IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN);
// Volume name + '\0' // Volume name + '\0'
char *volName = new char [strlen(buffer) + 1]; size_t volNameSize = strlen(buffer) + 1;
strcpy(volName, buffer); char *volName = new char [volNameSize];
strcat(buffer, ":"); Common::strcpy_s(volName, volNameSize, buffer);
Common::strcat_s(buffer, ":");
BPTR volumeLock = IDOS->Lock((STRPTR)buffer, SHARED_LOCK); BPTR volumeLock = IDOS->Lock((STRPTR)buffer, SHARED_LOCK);
if (volumeLock) { if (volumeLock) {