From: Christoph von Wittich Date: Thu, 28 Jul 2016 15:12:23 +0000 (+0000) Subject: [SHELL32]check for NULL pointer in CShellLink::SetDescription. patch by Joachim Henze... X-Git-Tag: backups/sndblst@72664~562 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=de1219eb52e9c0aec38dd5dfac8d11c593aab45c [SHELL32]check for NULL pointer in CShellLink::SetDescription. patch by Joachim Henze. fixes Opera 12 installer CORE-5272 svn path=/trunk/; revision=72033 --- 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;