Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

Closed Issue: v1 walk throws exception on bad(?) data from printer [7241]

$
0
0
Hi Lex
I found a Canon iR C3580 printer that responds in such a way to cause a v1 walk to throw an exception and halt the walk. When the walk arrives at .1.3.6.1.2.1.2.2.1.21.2, an exception is thrown:

Unhandled Exception: System.ArgumentException: length cannot be 0
Parameter name: length
at Lextm.SharpSnmpLib.ObjectIdentifier..ctor(Tuple`2 length, Stream stream) i
n C:\CodeOther\SharpSnmp\SharpSnmpLib\ObjectIdentifier.cs:line 132

Using a different tool, Bytesphere Walk Agent, it gets through ok
<snip output>
.1.3.6.1.2.1.2.2.1.20.1 COUNTER 0
.1.3.6.1.2.1.2.2.1.20.2 COUNTER 0
.1.3.6.1.2.1.2.2.1.21.1 UINT32 0
.1.3.6.1.2.1.2.2.1.21.2 UINT32 0
.1.3.6.1.4.1.1602.1.1.1.1.0 OCTET-STRING iR C3580
.1.3.6.1.4.1.1602.1.1.1.2.0 OCTET-STRING P24074
.1.3.6.1.4.1.1602.1.1.1.3.0 INTEGER 13
.1.3.6.1.4.1.1602.1.1.1.4.0 OCTET-STRING 92.05
</snip output>

Please see attached file for sample stack trace output and a small unit test which reproduces the failure. The byte string in the test is exactly that returned by the device (Broke into the parser method and used BitConverter.ToString(buffer) and replaced all hashes at the point of failure).

I tried to look at fixing it myself but the nested SNMP parsing is a bit beyond my expertise!

Viewing all articles
Browse latest Browse all 576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>