Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of counter 64 values fail with large numbers #81

Closed
madari opened this issue Sep 22, 2016 · 0 comments
Closed

Handling of counter 64 values fail with large numbers #81

madari opened this issue Sep 22, 2016 · 0 comments

Comments

@madari
Copy link
Contributor

madari commented Sep 22, 2016

Hi,

I'm running into a problem where gosnmp (and WapSNMP if that matters) fails to decode large counter 64 values.

Here's an example with logging enabled. I added a log line to parseInt64 to dump the input bytes:

Packet sanity verified, we got all the bytes ([62])
parseInt64: 01
Parsed version [1]
Parsed community [redacted]
getResponseLength: [43]
parseInt64: d4 6a 68 fa
requestID: [3563743482]
parseInt64: 00
errorStatus: [0]
parseInt64: 00
error-index: [0]
vblLength: [29]
OID: [.1.3.6.1.2.1.31.1.1.1.11.502]
[decodeValue: type is Counter64]
parseInt64: 00 ff ff ff ff ff 1e e5 3a
decodeValue: err is [integer too large]

9 bytes are passed into parseInt64: 00 ff ff ff ff ff 1e e5 3a, which causes it to immediately fail. snmp4j (and net-snmp) both successfully parse this value simply dropping the leading 0-octet.

Please see http://grepcode.com/file/repo1.maven.org/maven2/org.snmp4j/snmp4j/1.8.1/org/snmp4j/asn1/BER.java#BER.decodeUnsignedInt64%28org.snmp4j.asn1.BERInputStream%2Corg.snmp4j.asn1.BER.MutableByte%29 for how this is handled in snmp4j.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant