vincentbernat/snimpy — pull request #14 by maugier (2014-08-04 14:30:35+00:00)
Title: Work around bug in some SNMP stacks

Hi,

On some particular brand of switch i'm using there is what I suppose is a bug in their SNMP implementation, which causes it to generate OIDs made of large 32bits integers, where an octet string is expected.

This causes snimpy to choke on it when trying to convert it to a python bytes object. Net-SNMP just truncates the integers to bytes when asked to convert to string, which happens to work in this case (the bogus integers are of the form 0xffffff00 + expected byte)

I know this may be a dangerous change, but for me the easiest fix was to let snimpy perform the same truncation, with the enclosed patch. As far as I can tell it should not break existing code, but i will understand if you choose to reject it :)