From b430b691ac28eab9630c0c4e065f100437338422 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 30 Jul 2007 21:04:38 +0000 Subject: [PATCH] add a NULL pointer check See issue #2508 for more details. svn path=/trunk/; revision=28050 --- reactos/base/applications/regedit/childwnd.c | 4 ++-- reactos/base/applications/regedit/regproc.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/regedit/childwnd.c b/reactos/base/applications/regedit/childwnd.c index 6bf2f150076..e5aef35c032 100644 --- a/reactos/base/applications/regedit/childwnd.c +++ b/reactos/base/applications/regedit/childwnd.c @@ -512,7 +512,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa HKEY hRootKey; HKEY hKey = NULL; LPNMTVDISPINFO ptvdi; - LONG lResult; + LONG lResult = ERROR_SUCCESS; TCHAR szBuffer[MAX_PATH]; ptvdi = (LPNMTVDISPINFO) lParam; @@ -531,7 +531,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa { lResult = RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText); } - return lResult == ERROR_SUCCESS; + return lResult; } } default: diff --git a/reactos/base/applications/regedit/regproc.c b/reactos/base/applications/regedit/regproc.c index 79427197bd6..78d2f65f52d 100644 --- a/reactos/base/applications/regedit/regproc.c +++ b/reactos/base/applications/regedit/regproc.c @@ -1606,6 +1606,9 @@ LONG RegRenameKey(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNewName) LPTSTR lpNewSubKey = NULL; LONG Ret = 0; + if (!lpSubKey) + return Ret; + s = _tcsrchr(lpSubKey, _T('\\')); if (s) {