easysnmp / easysnmp

A blazingly fast and Pythonic SNMP library based on the official Net-SNMP bindings
http://www.net-snmp.org/
Other
212 stars 80 forks source link

[BUG] Empty string in second argument for `set` results in segmentation fault #197

Open bmitc opened 6 months ago

bmitc commented 6 months ago

EasySNMP release version OR commit number easysnmp-0.2.6. Specifically: easysnmp-0.2.6-cp310-cp310-manylinux_2_24_x86_64.whl

Operating System and Version

Net-SNMP Library Version Not sure at the moment.

Describe the bug Passing an empty string for the second argument in a set method call results in a segmentation fault.

>>> session.set('.1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.1.3', '')
Segmentation fault
$ <exits back to console>

To Reproduce See bug description.

Expected behavior No segmentation fault. At the worst, an exception should be raised.

Screenshots n/a

Additional context This was found while I am coming up to speed on SNMP to remotely control a Cyberpower PDU.

bmitc commented 6 months ago

I'm seeing more segmentation faults with set today as well in other instances. Even something as simple as:

session.set('.1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.1', '2')

segfaults.

It's possible that this is not the correct command for my device, but an exception is expected. A segmentation fault should always be treated as a bug.

I'm not sure of the exact issues, but I'm starting to feel that this library is not well-suited for inclusion in applications that need to be highly reliable and robust. This isn't a judgement, just an observation relevant to these bugs.