mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Use strncpy instead of strcpy because again, buffer overflows
This commit is contained in:
parent
7769da9434
commit
79c34c68db
92 changed files with 298 additions and 279 deletions
|
|
@ -142,7 +142,7 @@ static UINT_PTR CALLBACK FolderHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPA
|
|||
#ifdef UNICODE
|
||||
convertUTF16toUTF8(buf, filePath);
|
||||
#else
|
||||
dStrcpy( filePath, buf );
|
||||
dStrcpy( filePath, buf, MAX_PATH );
|
||||
#endif
|
||||
|
||||
// [tom, 12/8/2006] Hack to remove files from the list because
|
||||
|
|
@ -333,8 +333,8 @@ bool FileDialog::Execute()
|
|||
char pszFile[MAX_PATH];
|
||||
char pszFilter[1024];
|
||||
char pszFileTitle[MAX_PATH];
|
||||
dStrcpy( pszFile, mData.mDefaultFile );
|
||||
dStrcpy( pszFilter, mData.mFilters );
|
||||
dStrcpy( pszFile, mData.mDefaultFile, MAX_PATH );
|
||||
dStrcpy( pszFilter, mData.mFilters, 1024 );
|
||||
const char* pszInitialDir = mData.mDefaultPath;
|
||||
const char* pszTitle = mData.mTitle;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ bool FileDialog::Execute()
|
|||
convertUTF16toUTF8DoubleNULL( (UTF16*)pszFile, (UTF8*)pszResult, sizeof(pszResult));
|
||||
#else
|
||||
if(pszFileTitle[0] || ! ( mData.mStyle & FileDialogData::FDS_OPEN && mData.mStyle & FileDialogData::FDS_MULTIPLEFILES ))
|
||||
dStrcpy(pszResult,pszFile);
|
||||
dStrcpy(pszResult,pszFile,MAX_PATH);
|
||||
else
|
||||
{
|
||||
// [tom, 1/4/2007] pszResult is a double-NULL terminated, NULL separated list in this case so we can't just dSstrcpy()
|
||||
|
|
@ -614,7 +614,7 @@ bool FileDialog::setDefaultPath( void *object, const char *index, const char *da
|
|||
|
||||
// Copy and Backslash the path (Windows dialogs are VERY picky about this format)
|
||||
static char szPathValidate[512];
|
||||
dStrcpy( szPathValidate, data );
|
||||
dStrcpy( szPathValidate, data, 512 );
|
||||
|
||||
Platform::makeFullPathName( data,szPathValidate, sizeof(szPathValidate));
|
||||
backslash( szPathValidate );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue