I just ran into a segfault in netsnmp_swinst_arch_load() where if the 
pkg_directory name is set, but the dir can't be opened, it was still attempting 
to read the NULL descriptor.

Symptom: snmpd segfault when walking the entire MIB (one of the Host Resources 
tables)

Patch below. Apologies if this is already known/fixed.

Cheers,
        -Joe


--- /home/jlorenz/netsnmp-5.7/agent/mibgroup/host/data_access/swinst_pkginfo.c 
      2011-07-01 18:35:46.000000000 -0400
+++ agent/mibgroup/host/data_access/swinst_pkginfo.c    2011-09-30 
11:55:09.000000000 -0400
@@ -102,6 +102,10 @@
                           if there isn't a list of them! */
      }
      d = opendir( pkg_directory );
+    if ( !d ) {
+        snmp_log( LOG_ERR, "SWInst: could not open package directory %s\n", 
pkg_directory );
+        return 1;
+    }
      while (NULL != (dp = readdir( d ))) {
          if ( '.' == dp->d_name[0] )
              continue;


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to