mirror of
https://github.com/OpenVPN/openvpn.git
synced 2024-09-20 12:02:28 +02:00
Use appropriate buffer size for WideCharToMultiByte output in interactive.c
A widechar can potentially take more than 2 bytes in UTF-8. Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1457241722-23433-1-git-send-email-selva.nair@gmail.com> URL: http://article.gmane.org/gmane.network.openvpn.devel/11318 Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
239d09938b
commit
3654d953eb
@ -1063,17 +1063,16 @@ RunOpenvpn (LPVOID p)
|
||||
CloseHandleEx (&stdin_read);
|
||||
CloseHandleEx (&svc_pipe);
|
||||
|
||||
DWORD input_size = wcslen (sud.std_input) * 2;
|
||||
if (input_size)
|
||||
DWORD input_size = WideCharToMultiByte (CP_UTF8, 0, sud.std_input, -1, NULL, 0, NULL, NULL);
|
||||
LPSTR input = NULL;
|
||||
if (input_size && (input = malloc (input_size)))
|
||||
{
|
||||
DWORD written;
|
||||
LPSTR input = malloc (input_size);
|
||||
WideCharToMultiByte (CP_UTF8, 0, sud.std_input, -1, input, input_size, NULL, NULL);
|
||||
WriteFile (stdin_write, input, strlen (input), &written, NULL);
|
||||
free (input);
|
||||
}
|
||||
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
DWORD bytes = PeekNamedPipeAsync (ovpn_pipe, 1, &exit_event);
|
||||
|
Loading…
Reference in New Issue
Block a user