mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 05:20:54 +00:00
Check if the GetWindowsDirectory call succeeded and use PathAppend to prevent a buffer overflow, when WinDir + "\regedit.exe" > MAX_PATH
svn path=/trunk/; revision=33571
This commit is contained in:
parent
b00f2fbdd7
commit
722735c754
1 changed files with 6 additions and 4 deletions
|
@ -1,16 +1,18 @@
|
|||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
int WINAPI _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
|
||||
LPTSTR lpsCmdLine, int nCmdShow)
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
|
||||
GetWindowsDirectory(szPath, MAX_PATH);
|
||||
_tcscat(szPath, _T("\\regedit.exe"));
|
||||
|
||||
ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
|
||||
if(GetWindowsDirectory(szPath, MAX_PATH))
|
||||
{
|
||||
PathAppend(szPath, _T("regedit.exe"));
|
||||
ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue