[SNMP4J] Negative Request IDs
robert.m.dabell at L-3com.com
robert.m.dabell at L-3com.com
Mon Oct 24 19:40:10 CEST 2005
Frank,
First of all, I think SNMP4J is great. It has helped me out a lot.
Is there a SNMP rule that states that Request IDs cannot be negative? I
have an agent written with SNMP4J-Agent with a non-SNMP4J Manager that is
sending negative request IDs that is causing a buffer overflow in the agent
when it is encoding the last bytes of the buffer. I have suspected the
request ID because with positive request IDs are used it works fine. I have
traced the root of the problem to the getBERPayloadLengthPDU() function
call.
Integer32 i32 = new Integer32((requestID.getValue() > 0) ?
requestID.getValue() : 0xFFFFFFFF);
length += i32.getBERLength();
If the request id is negative then its length is set to 1 because the
BERLength of 0xFFFFFFFF(-1) is 1. This throws off the buffer position if
the request ID is negative and takes up more than 1 byte of space. If the
request IDs cannot be negative then I think there should be a least a log
message that negative req. IDs are not supported and I'll find a work
around. If they can be negative then this is a bug.
Mark DaBell
More information about the SNMP4J
mailing list