mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 12:23:28 +00:00
[MSAFD] Add some parameters check for WSPBind. Inspired by results of bind test
svn path=/trunk/; revision=74668
This commit is contained in:
@@ -860,6 +860,27 @@ WSPBind(SOCKET Handle,
|
||||
if (lpErrno) *lpErrno = WSAENOTSOCK;
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
if (Socket->SharedData->State != SocketOpen)
|
||||
{
|
||||
if (lpErrno) *lpErrno = WSAEINVAL;
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
if (!SocketAddress || SocketAddressLength < Socket->SharedData->SizeOfLocalAddress)
|
||||
{
|
||||
if (lpErrno) *lpErrno = WSAEINVAL;
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
|
||||
/* Get Address Information */
|
||||
Socket->HelperData->WSHGetSockaddrType ((PSOCKADDR)SocketAddress,
|
||||
SocketAddressLength,
|
||||
&SocketInfo);
|
||||
|
||||
if (SocketInfo.AddressInfo == SockaddrAddressInfoBroadcast && !Socket->SharedData->Broadcast)
|
||||
{
|
||||
if (lpErrno) *lpErrno = WSAEADDRNOTAVAIL;
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
|
||||
Status = NtCreateEvent(&SockEvent,
|
||||
EVENT_ALL_ACCESS,
|
||||
@@ -887,11 +908,6 @@ WSPBind(SOCKET Handle,
|
||||
SocketAddress->sa_data,
|
||||
SocketAddressLength - sizeof(SocketAddress->sa_family));
|
||||
|
||||
/* Get Address Information */
|
||||
Socket->HelperData->WSHGetSockaddrType ((PSOCKADDR)SocketAddress,
|
||||
SocketAddressLength,
|
||||
&SocketInfo);
|
||||
|
||||
/* Set the Share Type */
|
||||
if (Socket->SharedData->ExclusiveAddressUse)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user