mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
Fix potential buffer overflows
This commit is contained in:
parent
cadc390895
commit
8d4679b2b7
1 changed files with 5 additions and 4 deletions
|
|
@ -75,10 +75,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdL
|
|||
return -1;
|
||||
}
|
||||
|
||||
enum { errorSize = 4096 };
|
||||
if (!hGame)
|
||||
{
|
||||
wchar_t error[4096];
|
||||
_swprintf_l(error, sizeof(error), L"Unable to load game library: %s. Please make sure it exists and the latest DirectX is installed.", _get_current_locale(), dllName.c_str());
|
||||
wchar_t error[errorSize];
|
||||
_swprintf_l(error, errorSize, L"Unable to load game library: %s. Please make sure it exists and the latest DirectX is installed.", _get_current_locale(), dllName.c_str());
|
||||
MessageBoxW(NULL, error, L"Error", MB_OK|MB_ICONWARNING);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -86,8 +87,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdL
|
|||
torque_winmain = (int (*)(HINSTANCE hInstance, HINSTANCE h, LPSTR lpszCmdLine, int nShow))GetProcAddress(hGame, "torque_winmain");
|
||||
if (!torque_winmain)
|
||||
{
|
||||
wchar_t error[4096];
|
||||
_swprintf_l(error, sizeof(error), L"Missing torque_winmain export in game library: %s. Please make sure that it exists and the latest DirectX is installed.", _get_current_locale(), dllName.c_str());
|
||||
wchar_t error[errorSize];
|
||||
_swprintf_l(error, errorSize, L"Missing torque_winmain export in game library: %s. Please make sure that it exists and the latest DirectX is installed.", _get_current_locale(), dllName.c_str());
|
||||
MessageBoxW(NULL, error, L"Error", MB_OK|MB_ICONWARNING);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue