From de1219eb52e9c0aec38dd5dfac8d11c593aab45c Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 28 Jul 2016 15:12:23 +0000 Subject: [PATCH] [SHELL32]check for NULL pointer in CShellLink::SetDescription. patch by Joachim Henze. fixes Opera 12 installer CORE-5272 svn path=/trunk/; revision=72033 --- reactos/dll/win32/shell32/CShellLink.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/shell32/CShellLink.cpp b/reactos/dll/win32/shell32/CShellLink.cpp index e639f62070c..8b5bb30182c 100644 --- a/reactos/dll/win32/shell32/CShellLink.cpp +++ b/reactos/dll/win32/shell32/CShellLink.cpp @@ -1332,12 +1332,17 @@ HRESULT WINAPI CShellLink::SetDescription(LPCWSTR pszName) TRACE("(%p)->(desc=%s)\n", this, debugstr_w(pszName)); HeapFree(GetProcessHeap(), 0, sDescription); - sDescription = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - (wcslen(pszName) + 1) * sizeof(WCHAR)); - if (!sDescription) - return E_OUTOFMEMORY; + if (pszName) + { + sDescription = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + (wcslen(pszName) + 1) * sizeof(WCHAR)); + if (!sDescription) + return E_OUTOFMEMORY; - wcscpy(sDescription, pszName); + wcscpy(sDescription, pszName); + } + else + sDescription = NULL; bDirty = TRUE; return S_OK;