[SNMP4J] Negative Request IDs
robert.m.dabell at L-3com.com
robert.m.dabell at L-3com.com
Wed Oct 26 23:13:26 CEST 2005
Frank,
After a little more research I've read that because the request ID is
specified as an Integer32 that the agent should be able to handle request
IDs that are from -2^31 to (2^31)-1. Therefore, I can only conclude that
there is a bug in the agent if a request is negative. I modified the
getBERPayloadLengthPDU function to fix this bug by replacing this line
Integer32 i32 = new Integer32((requestID.getValue() > 0) ?
requestID.getValue() : 0xFFFFFFFF);
with
Integer32 i32 = requestID;
in PDU.java.
I've tested this and it fixes my problems with negative request IDs.
Mark DaBell
-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org]On
Behalf Of robert.m.dabell at L-3com.com
Sent: Monday, October 24, 2005 11:40 AM
To: SNMP4J at agentpp.org
Subject: [SNMP4J] Negative Request IDs
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
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j
More information about the SNMP4J
mailing list