Bug 1126914

Summary: Ocetets Truncated with Python Bindings
Product: Red Hat Enterprise Linux 6 Reporter: kurt.frederiksen
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.7CC: dapospis
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:22:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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):
net-snmp-5.5-49.el6_5.1.x86_64

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.

https://rhn.redhat.com/errata/RHSA-2015-1385.html