Skip to content

Commit

Permalink
Fix for a bug in GetCORSystemDirectoryInternaL
Browse files Browse the repository at this point in the history
Change 7045ca7 introduced a bug in
GetCORSystemDirectoryInternaL. The second parameter of GetRuntimeDirectory
is in/out so passing a pointer to an uninitialized cchBuffer was wrong.
The fix is to initialize cchBuffer to MAX_PATH - 1.

This was causing failures in some non CoreClr ngen scenarios.
  • Loading branch information
erozenfeld committed Mar 10, 2016
1 parent 7d81c53 commit 9ebfb37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dlls/mscoree/mscoree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,13 @@ STDAPI GetCORSystemDirectoryInternaL(SString& pBuffer)
return hr;

#else // FEATURE_CORECLR || CROSSGEN_COMPILE
DWORD cchBuffer;
DWORD cchBuffer = MAX_PATH - 1;
// Simply forward the call to the ICLRRuntimeInfo implementation.
STATIC_CONTRACT_WRAPPER;
HRESULT hr = S_OK;
if (g_pCLRRuntime)
{
WCHAR* temp = pBuffer.OpenUnicodeBuffer(MAX_PATH - 1);
WCHAR* temp = pBuffer.OpenUnicodeBuffer(cchBuffer);
hr = g_pCLRRuntime->GetRuntimeDirectory(temp, &cchBuffer);
pBuffer.CloseBuffer(cchBuffer - 1);
}
Expand Down

0 comments on commit 9ebfb37

Please sign in to comment.