Author: cgutman
Date: Sun Jul 17 20:19:20 2011
New Revision: 52720
URL:
http://svn.reactos.org/svn/reactos?rev=52720&view=rev
Log:
[MSAFD]
- Fix several bugs in WSPGetSockName and WSPGetPeerName
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sun Jul 17 20:19:20 2011
@@ -1810,13 +1810,13 @@
if (NT_SUCCESS(Status))
{
- if (*NameLength >= SocketAddress->Address[0].AddressLength)
+ if (*NameLength >= Socket->SharedData.SizeOfLocalAddress)
{
Name->sa_family = SocketAddress->Address[0].AddressType;
RtlCopyMemory (Name->sa_data,
SocketAddress->Address[0].Address,
SocketAddress->Address[0].AddressLength);
- *NameLength = 2 + SocketAddress->Address[0].AddressLength;
+ *NameLength = Socket->SharedData.SizeOfLocalAddress;
AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %x Port %x\n",
*NameLength, ((struct sockaddr_in *)Name)->sin_addr.s_addr,
((struct sockaddr_in *)Name)->sin_port));
@@ -1882,7 +1882,7 @@
}
/* Allocate a buffer for the address */
- TdiAddressSize = sizeof(TRANSPORT_ADDRESS) + *NameLength;
+ TdiAddressSize = sizeof(TRANSPORT_ADDRESS) +
Socket->SharedData.SizeOfRemoteAddress;
SocketAddress = HeapAlloc(GlobalHeap, 0, TdiAddressSize);
if ( SocketAddress == NULL )
@@ -1915,13 +1915,13 @@
if (NT_SUCCESS(Status))
{
- if (*NameLength >= SocketAddress->Address[0].AddressLength)
+ if (*NameLength >= Socket->SharedData.SizeOfRemoteAddress)
{
Name->sa_family = SocketAddress->Address[0].AddressType;
RtlCopyMemory (Name->sa_data,
SocketAddress->Address[0].Address,
SocketAddress->Address[0].AddressLength);
- *NameLength = 2 + SocketAddress->Address[0].AddressLength;
+ *NameLength = Socket->SharedData.SizeOfRemoteAddress;
AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %s Port %x\n",
*NameLength, ((struct sockaddr_in *)Name)->sin_addr.s_addr,
((struct sockaddr_in *)Name)->sin_port));