[PATCH] ws2_32: Fixed buffersize to MultiByteToWideChar

Marcus Meissner marcus at jet.franken.de
Sun Jul 19 08:31:28 CDT 2009


Hi,

Gets character count, not bytes.

Ciao, Marcus
---
 dlls/ws2_32/socket.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 96be7ca..1492640 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5007,7 +5007,7 @@ INT WINAPI WSAAddressToStringW( LPSOCKADDR sockaddr, DWORD len,
                                 LPDWORD lenstr )
 {
     INT   ret;
-    DWORD size, sizew;
+    DWORD size;
     WCHAR buffer[54]; /* 32 digits + 7':' + '[' + '%" + 5 digits + ']:' + 5 digits + '\0' */
     CHAR bufAddr[54];
 
@@ -5018,8 +5018,7 @@ INT WINAPI WSAAddressToStringW( LPSOCKADDR sockaddr, DWORD len,
 
     if (ret) return ret;
 
-    sizew = sizeof( buffer );
-    MultiByteToWideChar( CP_ACP, 0, bufAddr, size, buffer, sizew );
+    MultiByteToWideChar( CP_ACP, 0, bufAddr, size, buffer, sizeof( buffer )/sizeof(WCHAR));
 
     if (*lenstr <  size)
     {
-- 
1.5.6



More information about the wine-patches mailing list