Author: phater
Date: Thu May 25 12:34:33 2017
New Revision: 74649
URL:
http://svn.reactos.org/svn/reactos?rev=74649&view=rev
Log:
[WS2_32] Perform parameters check on bind. ROSTESTS-278
Modified:
trunk/reactos/dll/win32/ws2_32/src/socklife.c
Modified: trunk/reactos/dll/win32/ws2_32/src/socklife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/sockl…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/socklife.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/socklife.c [iso-8859-1] Thu May 25 12:34:33 2017
@@ -48,19 +48,27 @@
/* Get the Socket Context */
if ((Socket = WsSockGetSocket(s)))
{
- /* Make the call */
- Status = Socket->Provider->Service.lpWSPBind(s,
- name,
- namelen,
- &ErrorCode);
- /* Deference the Socket Context */
- WsSockDereference(Socket);
-
- /* Return Provider Value */
- if (Status == ERROR_SUCCESS) return Status;
-
- /* If everything seemed fine, then the WSP call failed itself */
- if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE;
+ if (name && (namelen >= sizeof(struct sockaddr)))
+ {
+ /* Make the call */
+ Status = Socket->Provider->Service.lpWSPBind(s,
+ name,
+ namelen,
+ &ErrorCode);
+ /* Deference the Socket Context */
+ WsSockDereference(Socket);
+
+ /* Return Provider Value */
+ if (Status == ERROR_SUCCESS) return Status;
+
+ /* If everything seemed fine, then the WSP call failed itself */
+ if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE;
+ }
+ else
+ {
+ /* name or namelen not valid */
+ ErrorCode = WSAEFAULT;
+ }
}
else
{