[SHELL32] CQueryAssociation: Add slash check (#6676)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Wed, 27 Mar 2024 08:36:48 +0000 (17:36 +0900)
committerGitHub <noreply@github.com>
Wed, 27 Mar 2024 08:36:48 +0000 (17:36 +0900)
Follow-up to #6656. I had forgotten to check the slash.
JIRA issue: CORE-19493
Add StrChrW(pszAssoc, L'\\') check before PathFindExtensionW call.

dll/win32/shell32/CQueryAssociations.cpp

index 974ea5d..f115a3d 100644 (file)
@@ -98,9 +98,12 @@ HRESULT STDMETHODCALLTYPE CQueryAssociations::Init(
         HRESULT hr;
         LPCWSTR pchDotExt;
 
-        pchDotExt = PathFindExtensionW(pszAssoc);
-        if (pchDotExt && *pchDotExt)
-            pszAssoc = pchDotExt;
+        if (StrChrW(pszAssoc, L'\\'))
+        {
+            pchDotExt = PathFindExtensionW(pszAssoc);
+            if (pchDotExt && *pchDotExt)
+                pszAssoc = pchDotExt;
+        }
 
         LONG ret = RegOpenKeyExW(HKEY_CLASSES_ROOT,
                             pszAssoc,