prevent buffer overflow, LoadString accepts the size of the buffer in TCHARs, not in bytes!

svn path=/trunk/; revision=14980
This commit is contained in:
Thomas Bluemel 2005-05-04 22:21:55 +00:00
parent 410ddcfe72
commit c1b7289bd6

View file

@ -280,8 +280,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho
WCHAR PromptMsg[RC_STRING_MAX_SIZE];
CHAR InputBuffer[255];
LoadString( GetModuleHandle(NULL), STRING_WelcomeMsg, (LPTSTR) WelcomeMsg,sizeof(WelcomeMsg));
LoadString( GetModuleHandle(NULL), STRING_PromptMsg, (LPTSTR) PromptMsg ,sizeof(PromptMsg));
LoadString( GetModuleHandle(NULL), STRING_WelcomeMsg, (LPTSTR) WelcomeMsg,sizeof(WelcomeMsg) / sizeof(WelcomeMsg[0]));
LoadString( GetModuleHandle(NULL), STRING_PromptMsg, (LPTSTR) PromptMsg ,sizeof(PromptMsg) / sizeof(PromptMsg[0]));
AllocConsole();
SetConsoleTitleW(L"ntvdm");