diff --git a/src/libutil/windows/environment-variables.cc b/src/libutil/windows/environment-variables.cc index 525d08c64..5ce8a1395 100644 --- a/src/libutil/windows/environment-variables.cc +++ b/src/libutil/windows/environment-variables.cc @@ -13,7 +13,7 @@ std::optional getEnvOs(const OsString & key) } // Allocate a buffer to hold the environment variable value - std::wstring value{L'\0', bufferSize}; + std::wstring value{bufferSize, L'\0'}; // Retrieve the environment variable value DWORD resultSize = GetEnvironmentVariableW(key.c_str(), &value[0], bufferSize);