[SNMP4J] Bug in OID class

Frank Fock fock at agentpp.com
Mon Feb 6 18:43:39 CET 2017


Hi Steffen,

Thanks for the bug report. Will be fixed very soon with SNMP4J 2.5.5.

Best regards,
Frank

Am 06.02.2017 um 17:17 schrieb Steffen Brüntjen:
> Hi!
>
> I found a problem in the OID class. The nextPeer() method runs into a StackOverflowError. The method:
>
>    public final OID nextPeer() {
>      OID next = new OID(this);
>      if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) {
>        next.set(next.size()-1, last()+1);
>      }
>      else if (next.size() > 1) {
>        next.trim(1);
>        next = nextPeer();
>      }
>      return next;
>    }
>
>
> The fix:
>
> - next = nextPeer()
> + next = next.nextPeer();
>
>
> Here's a test case:
>
>    @Test
>    public void testNextPeer() {
>      OID oid = new OID(new int[] { 1, 0xFFFFFFFF });
>      oid.nextPeer();
>    }
>
>
> Best regards,
> Steffen Brüntjen
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list