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(a)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/dllma…
==============================================================================
--- 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));