Bug 1126914 - Ocetets Truncated with Python Bindings
Summary: Ocetets Truncated with Python Bindings
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: net-snmp
Version: 6.7
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jan Safranek
QA Contact: Dalibor Pospíšil
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-05 15:05 UTC by kurt.frederiksen
Modified: 2015-07-22 07:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Net-SNMP Python bindings did not check input string of netsnmp_set call and copied only part of the string to the outgoing SNMP SET request when the string contained character with ASCII value 0. Consequence: A Python application could send invalid SNMP SET requests Fix: The Python binding copies full string, including any '\0' characters. Result: Applications send valid SNMP SET requests.
Clone Of:
Last Closed: 2015-07-22 07:22:55 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1385 normal SHIPPED_LIVE Moderate: net-snmp security and bug fix update 2015-07-20 18:07:39 UTC

Description kurt.frederiksen 2014-08-05 15:05:59 UTC
Description of problem:
Ocetets Truncated with Python Bindings.

Version-Release number of selected component (if applicable):

How reproducible:
Use net-snmp python bindings to set a SMI object that is of the DateAndTime. Use the date and time of 01/01/2010 00:00. Observe the result on the wire. Observe that the bindings read the '00' characters as a termination character.

Steps to Reproduce:
1. Install net-snmp-python
2. Set DateAndTime object with 01/01/2010 00:00
3. Observe result.

Actual results:
01/01/2010 00:00 is seen as 0x07da0101 on the wire. Which is wrong length per the SMI for DateAndTime per the SNMPv2-TC MIB.

Expected results:
01/01/2010 00:00 should result i na set of 0x07da0101000f0000.

Additional info:
This issue has been resolved in a later version of net-snmp.  A patch which backports the fix to net-snmp-5.5-49.el6_5.1.x86_64 can be found here http://sourceforge.net/p/net-snmp/bugs/2552/ . This patch has been tested by rebuilding the redhat rpm and installing it on the system.

Comment 2 Jan Safranek 2014-08-06 11:27:47 UTC
Thanks for the report.

Just for reference, this small python snippet sends 'hello' instead of 'hello.world', where '.' should be \0 character.

import netsnmp
oid = netsnmp.Varbind('sysDescr', val='hello\000world', type='OCTETSTR')
netsnmp.snmpset(oid, Version=2, DestHost='localhost', Community='public')

Comment 6 errata-xmlrpc 2015-07-22 07:22:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.