[AGENT++] Another bug in asn1.cpp on 64-bit Solaris platform - Counter64 values are wrong

Jochen Katz katz at agentpp.com
Sat May 23 20:57:39 CEST 2009


Hi,

yes this is a bug. As sizeof(int) could also change, I replaced it with
4 and simplified the complete function.

Regards,
  Jochen


Alex Agranov schrieb:
> I found another bug in asn1.cpp code on 64-bit Solaris platform that
> is caused by the wrong assumption that "sizeof(long) == 4" - while on
> this specific platform it's 8.

> The problem causes wrong values for VarBinds of type Counter64 to be
> returned in the SNMP-RESPONSE (typically 0 is returned instead of any
> value).

> The fix that I applied is pretty straightforward - I simply replaced
> "sizeof(long)" with "sizeof(int)" inside the
> asn_build_unsigned_int64() function (because "sizeof(int)==4" both
> for 32-bit and 64-bit Linux and Solaris - as per
> https://www.ibm.com/developerworks/linux/library/l-solar/). However I
> wonder whether "sizeof()" is needed here at all - 'cause ASN seems to
> clearly define the size of its elements...



More information about the AGENTPP mailing list