From c395db12e6a5aee4194b4115be488bd3435380bd Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 20 Feb 2018 08:10:13 -0800 Subject: [PATCH] Fix path searching for where.exe and request handler parsing (#595) --- src/AspNetCore/Src/applicationinfo.cpp | 2 +- src/CommonLib/hostfxr_utility.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AspNetCore/Src/applicationinfo.cpp b/src/AspNetCore/Src/applicationinfo.cpp index f5412a2ecb..74e0191dae 100644 --- a/src/AspNetCore/Src/applicationinfo.cpp +++ b/src/AspNetCore/Src/applicationinfo.cpp @@ -457,7 +457,7 @@ APPLICATION_INFO::FindNativeAssemblyFromHostfxr( // Split on semicolons, append aspnetcorerh.dll, and check if the file exists. while ((intIndex = struNativeSearchPaths.IndexOf(L";", intPrevIndex)) != -1) { - if (FAILED(hr = struNativeDllLocation.Copy(struNativeSearchPaths.QueryStr(), intIndex - intPrevIndex))) + if (FAILED(hr = struNativeDllLocation.Copy(&struNativeSearchPaths.QueryStr()[intPrevIndex], intIndex - intPrevIndex))) { goto Finished; } diff --git a/src/CommonLib/hostfxr_utility.cpp b/src/CommonLib/hostfxr_utility.cpp index 9e2c1a0e31..ab75a8a296 100644 --- a/src/CommonLib/hostfxr_utility.cpp +++ b/src/CommonLib/hostfxr_utility.cpp @@ -612,11 +612,12 @@ HOSTFXR_UTILITY::FindDotnetExePath( { break; } - if (FAILED(hr = struDotnetSubstring.Copy(struDotnetLocationsString.QueryStr(), index - prevIndex))) + if (FAILED(hr = struDotnetSubstring.Copy(&struDotnetLocationsString.QueryStr()[prevIndex], index - prevIndex))) { goto Finished; } - prevIndex = index + 1; + // \r\n is two wchars, so add 2 here. + prevIndex = index + 2; if (GetBinaryTypeW(struDotnetSubstring.QueryStr(), &dwBinaryType) && fIsCurrentProcess64Bit == (dwBinaryType == SCS_64BIT_BINARY)) {