diff --git a/OpenConsole.sln b/OpenConsole.sln index 843d866cc..493cba041 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -73,6 +73,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Host.unittest", "src\host\ut_lib\host.unittest.vcxproj", "{06EC74CB-9A12-429C-B551-8562EC954747}" ProjectSection(ProjectDependencies) = postProject {18D09A24-8240-42D6-8CB6-236EEE820263} = {18D09A24-8240-42D6-8CB6-236EEE820263} + {71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF} = {71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Host.Tests.Unit", "src\host\ut_host\Host.UnitTests.vcxproj", "{531C23E7-4B76-4C08-8AAD-04164CB628C9}" diff --git a/src/host/ut_host/ApiRoutinesTests.cpp b/src/host/ut_host/ApiRoutinesTests.cpp index bf0f7ed36..bece472c2 100644 --- a/src/host/ut_host/ApiRoutinesTests.cpp +++ b/src/host/ut_host/ApiRoutinesTests.cpp @@ -278,7 +278,7 @@ class ApiRoutinesTests nullptr, nullptr); - wistd::unique_ptr pszExpected = wil::make_unique_nothrow(iBytesNeeded); + wistd::unique_ptr pszExpected = wil::make_unique_nothrow(iBytesNeeded + 1); VERIFY_IS_NOT_NULL(pszExpected); VERIFY_WIN32_BOOL_SUCCEEDED(WideCharToMultiByte(gci.OutputCP, @@ -290,6 +290,9 @@ class ApiRoutinesTests nullptr, nullptr)); + // Make sure we terminate the expected title -- WC2MB does not add the \0 if we use the size variant + pszExpected[iBytesNeeded] = '\0'; + char pszTitle[MAX_PATH]; // most applications use MAX_PATH size_t cchWritten = 0; size_t cchNeeded = 0;