[ros-diffs] [khornicek] 38230: - avoid crash, pszExt is null when creating a link to a file without extension

khornicek at svn.reactos.org khornicek at svn.reactos.org
Sun Dec 21 13:17:37 CET 2008


Author: khornicek
Date: Sun Dec 21 06:17:36 2008
New Revision: 38230

URL: http://svn.reactos.org/svn/reactos?rev=38230&view=rev
Log:
- avoid crash, pszExt is null when creating a link to a file without extension

Modified:
    trunk/reactos/dll/win32/shell32/shv_def_cmenu.c

Modified: trunk/reactos/dll/win32/shell32/shv_def_cmenu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_def_cmenu.c?rev=38230&r1=38229&r2=38230&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] Sun Dec 21 06:17:36 2008
@@ -1202,11 +1202,9 @@
     if (StrRetToBufW(&strFile, This->dcm.apidl[0], szPath, MAX_PATH) != S_OK)
         return E_FAIL;
 
-
     pszExt = wcsrchr(szPath, L'.');
-    pszExt[0] = 0;
-
-    if (!wcsicmp(pszExt + 1, szLnk))
+
+    if (pszExt && !wcsicmp(pszExt + 1, szLnk))
     {
         if (!GetUniqueFileName(szPath, pszExt + 1, szTarget, TRUE))
             return E_FAIL;
@@ -1231,7 +1229,7 @@
         {
             return E_FAIL;
         }
-        pszExt[0] = '.';
+
         if (SUCCEEDED(IShellLinkW_SetPath(nLink, szPath)))
         {
             if (SUCCEEDED(IShellLinkW_QueryInterface(nLink, &IID_IPersistFile, (LPVOID*)&ipf)))



More information about the Ros-diffs mailing list