mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 14:51:00 +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 <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
|
int WINAPI _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
|
||||||
LPTSTR lpsCmdLine, int nCmdShow)
|
LPTSTR lpsCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
TCHAR szPath[MAX_PATH];
|
TCHAR szPath[MAX_PATH];
|
||||||
|
|
||||||
GetWindowsDirectory(szPath, MAX_PATH);
|
if(GetWindowsDirectory(szPath, MAX_PATH))
|
||||||
_tcscat(szPath, _T("\\regedit.exe"));
|
{
|
||||||
|
PathAppend(szPath, _T("regedit.exe"));
|
||||||
ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
|
ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue