python3-netsnmp icon indicating copy to clipboard operation
python3-netsnmp copied to clipboard

Segfault when trying to set/get with a bare Varbind

Open repnop opened this issue 4 years ago • 0 comments

Reproduction:

>>> import netsnmp
>>> session = netsnmp.Session(Version = 2, DestHost='localhost', Community='public')
>>> vbind = netsnmp.Varbind('sysUpTime', 0)
>>> session.set(vbind)
Segmentation fault
>>> import netsnmp
>>> session = netsnmp.Session(Version = 2, DestHost='localhost', Community='public')
>>> vbind = netsnmp.Varbind('sysUpTime', 0)
>>> session.get(vbind)
Segmentation fault

From what I could tell, it segfaults here: https://github.com/bluecmd/python3-netsnmp/blob/9f51ee26b3f70ddca9f35116ae53a08c16bb6b8f/netsnmp/client_intf.c#L1554 I'm assuming because there's no NULL check before trying to decrement the reference count, but I haven't used Python FFI so that's my best guess.

repnop avatar May 20 '20 15:05 repnop