From 5a212dff7dee325f10ec4e581f9b99935b955ec6 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 20 Nov 2019 14:29:07 +0100 Subject: [PATCH] winhttp: Pass correct buffer size to WideCharToMultiByte. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/winhttp/winhttp_private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 93cf0f7125e..734a1ad52ab 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -314,7 +314,7 @@ static inline WCHAR *strdupAW( const char *src ) WCHAR *dst = NULL; if (src) { - DWORD len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 ); + int len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 ); if ((dst = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len ); } @@ -341,7 +341,7 @@ static inline char *strdupWA_sized( const WCHAR *src, DWORD size ) int len = WideCharToMultiByte( CP_ACP, 0, src, size, NULL, 0, NULL, NULL ) + 1; if ((dst = heap_alloc( len ))) { - WideCharToMultiByte( CP_ACP, 0, src, len, dst, size, NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, src, size, dst, len, NULL, NULL ); dst[len - 1] = 0; } }