Hi Vincent 
I will fix it, but I think the error must be in the input stream, because the 
API clearly states, that if the length is 0, then 0 bytes are returned (and not 
-1 what you observed). Of course, the agent might also be the problem by 
encoding a wrong length.
Best regards 
Frank

> Am 22.08.2017 um 10:47 schrieb Vincent Zhang <vinct...@gmail.com>:
> 
> Hi Dear,
> I am not sure this is the correct mail address to report bug, please 
> I found a bug for snmp4j.  This is introduced in the latest snmp4j 2.5.7 
> release.
> 
> Behaviour: 
> When server returns an empty string for an oid, the 2.5.7 snmp4j will fail 
> with fail with exception while the older jars can work. 
> 
> Cause
> In the latest release, you have improved the performance for BRE. See the 
> line  799, the length will be 0 if the stream is already empty. In this case, 
> consume stream line 803 will always get -1, as a result it will fail to pass 
> the validation in line 804 and an exception will be thrown. 
> 
> <image.png>
> 
> Suggested Fix
> When the stream is already empty, we need not consume the stream anymore, 
> instead we can return the empty byte array as the previous snmp4j release did.
> 
> Why I am concerning this
> I am not sure if the snmp protocol allows server return an empty string for 
> an oid, but we do have related case in our product. My customers may have 
> snmp server returning empty string, so currently I am using the 2.5.6 snmp4j 
> as workaround. But it will be fantacy if the latest snmp4j release can 
> support empty string as response.
> 
> 
> Cheers.
> 
> Vincent
_______________________________________________
SNMP4J mailing list
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j

Reply via email to