From 89de0eb71783f80f48f5ecba3854fd719c8d218a Mon Sep 17 00:00:00 2001 From: Viktor Chernenko Date: Mon, 2 Jan 2023 14:56:18 +0100 Subject: [PATCH] While using ACE_Wide_To_Ascii string conversion class (and correspondingly ::WideCharToMultiByte) there must be expected that the length of the ouput multi-byte string is not equal to the length of the input unicode string. That's why we the variable iter used to iterate over the original unicode environment varaiables must be increased by the source string length (and not by the length of converted string). --- ACE/ace/Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp index 3a52b8bb9a463..9fc0c82f0faf1 100644 --- a/ACE/ace/Process.cpp +++ b/ACE/ace/Process.cpp @@ -932,7 +932,7 @@ ACE_Process_Options::inherit_environment () size_t const idx = temp_narrow_env.size (); temp_narrow_env.resize (idx + len + 1, 0); ACE_OS::strncpy (&temp_narrow_env[idx], wta.char_rep (), len); - iter += len; + iter += ACE_OS::strlen(iter); } temp_narrow_env.push_back (0); existing_environment = &temp_narrow_env[0];