prevent buffer overflow, LoadString accepts the size of the buffer in TCHARs, not in bytes! Modified: trunk/reactos/subsys/ntvdm/ntvdm.c _____
Modified: trunk/reactos/subsys/ntvdm/ntvdm.c --- trunk/reactos/subsys/ntvdm/ntvdm.c 2005-05-04 22:18:43 UTC (rev 14979) +++ trunk/reactos/subsys/ntvdm/ntvdm.c 2005-05-04 22:21:55 UTC (rev 14980) @@ -280,8 +280,8 @@
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");