From b6e91fa44b38b5771c6c694d8f6cfa607362fb49 Mon Sep 17 00:00:00 2001 From: Kevin Puetz Date: Wed, 5 Feb 2020 20:00:44 +0100 Subject: [PATCH] ntdll: Allow NULL lpAssemblyDirectoryName in find_actctx_dll. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ntdll/loader.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index b865d4f9ed5..85eb2976807 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2757,7 +2757,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) /* restart with larger buffer */ } - if (!info->lpAssemblyManifestPath || !info->lpAssemblyDirectoryName) + if (!info->lpAssemblyManifestPath) { status = STATUS_SXS_KEY_NOT_FOUND; goto done; @@ -2768,7 +2768,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR); p++; - if (strncmpiW( p, info->lpAssemblyDirectoryName, dirlen ) || strcmpiW( p + dirlen, dotManifestW )) + if (!dirlen || strncmpiW( p, info->lpAssemblyDirectoryName, dirlen ) || strcmpiW( p + dirlen, dotManifestW )) { /* manifest name does not match directory name, so it's not a global * windows/winsxs manifest; use the manifest directory name instead */ @@ -2786,6 +2786,12 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) } } + if (!info->lpAssemblyDirectoryName) + { + status = STATUS_SXS_KEY_NOT_FOUND; + goto done; + } + needed = (strlenW(user_shared_data->NtSystemRoot) * sizeof(WCHAR) + sizeof(winsxsW) + info->ulAssemblyDirectoryNameLength + nameW.Length + 2*sizeof(WCHAR));