mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +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:
parent
a09e47fe40
commit
b2b645b014
1 changed files with 21 additions and 5 deletions
|
@ -860,6 +860,27 @@ WSPBind(SOCKET Handle,
|
||||||
if (lpErrno) *lpErrno = WSAENOTSOCK;
|
if (lpErrno) *lpErrno = WSAENOTSOCK;
|
||||||
return SOCKET_ERROR;
|
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,
|
Status = NtCreateEvent(&SockEvent,
|
||||||
EVENT_ALL_ACCESS,
|
EVENT_ALL_ACCESS,
|
||||||
|
@ -887,11 +908,6 @@ WSPBind(SOCKET Handle,
|
||||||
SocketAddress->sa_data,
|
SocketAddress->sa_data,
|
||||||
SocketAddressLength - sizeof(SocketAddress->sa_family));
|
SocketAddressLength - sizeof(SocketAddress->sa_family));
|
||||||
|
|
||||||
/* Get Address Information */
|
|
||||||
Socket->HelperData->WSHGetSockaddrType ((PSOCKADDR)SocketAddress,
|
|
||||||
SocketAddressLength,
|
|
||||||
&SocketInfo);
|
|
||||||
|
|
||||||
/* Set the Share Type */
|
/* Set the Share Type */
|
||||||
if (Socket->SharedData->ExclusiveAddressUse)
|
if (Socket->SharedData->ExclusiveAddressUse)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue