Menu

#2026 segmentation fault in python bindings on null session

open
nobody
python (22)
5
2012-11-08
2009-02-11
Anonymous
No

Hi,

I was able to reproduce a bug affecting python bindings.

When creating a snmpv3 session towards an _unreachable_ host libsnmp-python caused a segfault when calling the get method.

It stores a null pointer as session pointer, and that is passed onwards to the snmpget code.

Actually this issue can be skipped in python by checking:

if sess.sess_ptr != 0:
...

but probably it would make sense to avoid creating the session object at all (so in the Session class contructor in python/netsnmp/client.py by raising an exception).

code to reproduce the issue:

import netsnmp
myvars = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.2.1.1.5.0', iid = ''))
sess = netsnmp.Session(Version = 3,SecLevel = 'noAuthPriv' , DestHost = '10.101.101.1', SecName= 'fake_user', Retries = 1, Timeout = 5 * 1000000)
res = sess.get(myvars)

Regards,

Gabriele Messineo
gabriele.messineo@winext.eu

Discussion


Log in to post a comment.