From 722735c75493e2ddcf6fd03519cb7895fe295ea4 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Sun, 18 May 2008 10:56:31 +0000 Subject: [PATCH] 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 --- reactos/base/applications/regedt32/regedt32.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/base/applications/regedt32/regedt32.c b/reactos/base/applications/regedt32/regedt32.c index 576114a8315..a7355e53100 100644 --- a/reactos/base/applications/regedt32/regedt32.c +++ b/reactos/base/applications/regedt32/regedt32.c @@ -1,16 +1,18 @@ #include #include #include +#include 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; }