[Pkg-net-snmp-devel] Bug#660874: Invoking snmpwalk with an hostname that does not exist results in a segmentation fault

Stefan Nordhausen stefan.nordhausen at axiros.com
Thu Jun 28 12:52:24 UTC 2012


Hi!

We also came across this bug. Turns out the Python bindings do not correctly check if a session could be established and keep using a NULL pointer in that case.

The following patch prevents the segfault in Frank's example program and raises an ordinary Exception instead:

--- ./net-snmp-5.4.3~dfsg/python/netsnmp/client.py	2009-04-23 16:21:53.000000000 +0000
+++ /usr/share/pyshared/netsnmp/client.py	2012-06-28 12:19:49.170930128 +0000
@@ -143,6 +143,8 @@
                 sess_args['PrivPass'],
                 sess_args['Engineboots'],
                 sess_args['Enginetime'])
+            if self.sess_ptr == 0:
+                raise Exception("Could not open session")
         else:
             self.sess_ptr = client_intf.session(
                 sess_args['Version'],
@@ -151,6 +153,8 @@
                 sess_args['LocalPort'],
                 sess_args['Retries'],
                 sess_args['Timeout'])
+            if self.sess_ptr == 0:
+                raise Exception("Could not open session")
         
     def get(self, varlist):
         res = client_intf.get(self, varlist)







More information about the Pkg-net-snmp-devel mailing list