[SHELL32] Stop SHELL_execute from always executing files (#4363)

CORE-18038
Add a check (PathIsExeW) to SHELL_execute to prevent it from executing non-exe files.
This commit is contained in:
Alex Miccolis 2022-02-15 17:54:20 -06:00 committed by GitHub
parent d64ab28b5f
commit 9b71653918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(exec);
EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath);
#define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY)
typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
@ -2139,6 +2141,10 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc)
lpFile = sei_tmp.lpFile;
wcmd = wcmdBuffer;
/* Only execute if it has an executable extension */
if (PathIsExeW(lpFile))
{
len = lstrlenW(wszApplicationName) + 3;
if (sei_tmp.lpParameters[0])
len += 1 + lstrlenW(wszParameters);
@ -2166,6 +2172,7 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc)
HeapFree(GetProcessHeap(), 0, wcmd);
return TRUE;
}
}
/* Else, try to find the executable */
wcmd[0] = L'\0';