[ros-diffs] [dchapyshev] 41294: WSPSelect() - Fix checking of params - Fix allocation size Tested on Firefox, Downloader, Skype Patch by Mikhail Denisenko (denisenkom at gmail.com) with small changes See issue #4526 for more details.

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Sat Jun 6 09:54:55 CEST 2009


Author: dchapyshev
Date: Sat Jun  6 11:54:54 2009
New Revision: 41294

URL: http://svn.reactos.org/svn/reactos?rev=41294&view=rev
Log:
WSPSelect()
- Fix checking of params
- Fix allocation size
Tested on Firefox, Downloader, Skype
Patch by Mikhail Denisenko (denisenkom at gmail.com) with small changes

See issue #4526 for more details.

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/dllmain.c?rev=41294&r1=41293&r2=41294&view=diff
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sat Jun  6 11:54:54 2009
@@ -700,10 +700,15 @@
                   ( writefds ? writefds->fd_count : 0 ) +
                   ( exceptfds ? exceptfds->fd_count : 0 );
 
-    if( HandleCount < 0 || nfds != 0 )
-        HandleCount = nfds * 3;
-
-    PollBufferSize = sizeof(*PollInfo) + (HandleCount * sizeof(AFD_HANDLE));
+    if ( HandleCount == 0 )
+    {
+        AFD_DbgPrint(MAX_TRACE,("HandleCount: %d. Return SOCKET_ERROR\n",
+                     HandleCount));
+        if (lpErrno) *lpErrno = WSAEINVAL;
+        return SOCKET_ERROR;
+    }
+
+    PollBufferSize = sizeof(*PollInfo) + ((HandleCount - 1) * sizeof(AFD_HANDLE));
 
     AFD_DbgPrint(MID_TRACE,("HandleCount: %d BufferSize: %d\n", 
                  HandleCount, PollBufferSize));



More information about the Ros-diffs mailing list