2009/4/21 Bart Van Assche <[email protected]>:
> <[email protected]> wrote:
>> OK - I've reverted that patch, and applied a simpler one to deal
>> with the immediate problem.  (i.e. skip any fd's that are too large
>> to be handled by fd_set, etc).
>
> Can you please remove the ">= FD_SETSIZE" tests again ? These cause
> the Windows snmpd.exe to stop immediately (all socket handles on
> Windows have a numeric value >= 1024).

Hmmm...
   as far as I can tell, the new "large_fd_set" processing still has
no protection against the socket being tested being outside the
valid set.

What about the attached patch?

Dave
Index: snmplib/snmp_api.c
===================================================================
--- snmplib/snmp_api.c	(revision 17515)
+++ snmplib/snmp_api.c	(working copy)
@@ -5668,13 +5668,11 @@
         snmp_log (LOG_INFO, "transport->sock got negative fd value %d\n", transport->sock);
         return 0; 
     }
-#ifdef FD_SETSIZE
     /* fd_sets can only handle so many sockets */
-    if (transport->sock >= FD_SETSIZE) {
+    if (transport->sock >= fdset->lfs_setsize) {
         snmp_log (LOG_INFO, "transport->sock got too large fd value %d\n", transport->sock);
         return 0; 
     }
-#endif
 
     if (!fdset || !(NETSNMP_FD_ISSET(transport->sock, fdset))) {
         DEBUGMSGTL(("sess_read", "not reading %d (fdset %p set %d)\n",
@@ -6184,15 +6182,13 @@
 
         DEBUGMSG(("sess_select", "%d ", slp->transport->sock));
 
-#ifdef FD_SETSIZE
-        if (slp->transport->sock >= FD_SETSIZE) {
+        if (slp->transport->sock >= fdset->lfs_setsize) {
             /*
              *  fd_sets can only handle so many sockets
              */
             DEBUGMSGTL(("sess_select", "Transport socket too big - skipping"));
             continue;
         }
-#endif
 
         if ((slp->transport->sock + 1) > *numfds) {
             *numfds = (slp->transport->sock + 1);
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to