Library version: 4.2.1
Testing found that certain values seem to be parsed
incorrectly. Code inspection found that 64 bit
counters are always parsed as signed integers. The
specification defines this value as an unsigned
integer. I have attached what should be a fix, based
on our testing.
Matthias
________________________________________________________________________________________________________
Matthias David Siebler
Software Developer
Sockeye Networks
[mds] diff snmplib/asn1.c
1492a1493,1496
> if (*bufp & 0x80) {
> low = ~low; /* integer is negative */
> high = ~high;
> }
[mds]
Logged In: YES
user_id=88893
Hmmm....
I'm not convinced that this patch is correct.
Yes - Counters *should* take non-negative values,
but they're encoded as BER INTEGERs, which
are inherently signed.
So if the parsing library receives a negative
integer when it's expecting a counter, I don't think
that simply ignoring this sign bit is correct.
At the very least, we should print some form of
debugging statement. And I'm tempted to say that
it should perhaps even reject this as a parsing error.
(in both asn_parse_unsigned_int and a_p_u_int64)
What does anyone else think?
[Sent to mailing list as well]
Diff:
This is a common confusion: the asn.1 serialization for a 64-bit unsigned value 0x8000000000000000 is the 9 bytes 0x008000000000000000.