ws2_32: Avoid using sizeof on structs with variable length array.
Michael Stefaniuc
mstefani at redhat.de
Fri Nov 16 04:11:57 CST 2012
---
dlls/ws2_32/socket.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 5c69d21..ceda75b 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1912,7 +1912,7 @@ static int WS2_register_async_shutdown( SOCKET s, int type )
TRACE("s %ld type %d\n", s, type);
- wsa = HeapAlloc( GetProcessHeap(), 0, sizeof(*wsa) );
+ wsa = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct ws2_async, iovec[1] ));
if ( !wsa )
return WSAEFAULT;
@@ -2450,7 +2450,7 @@ static BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int n
FD_WINE_CONNECTED|FD_WINE_LISTENING);
/* Indirectly call WSASend */
- if (!(wsa = HeapAlloc( GetProcessHeap(), 0, sizeof(*wsa) )))
+ if (!(wsa = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct ws2_async, iovec[1] ))))
{
SetLastError(WSAEFAULT);
}
--
1.7.7.6
More information about the wine-patches
mailing list