[AGENT++] asn_parse_int bug
hu shu
hushu999 at hotmail.com
Sun Dec 12 14:45:24 CET 2004
I have found a bug in snmp++ version 2.8 and snmp++ 3.X .When I'm working
on compaq tru64 platfrom, I found this bug in file names asn1.cpp.
“
case ASN_INTEGER:
vp->val.integer = (long *)malloc(sizeof(long));
vp->val_len = sizeof(long);
asn_parse_int(var_val, &len, &vp->type, (long *)vp->val.integer,
sizeof(vp->val.integer));
break;
case SMI_COUNTER:
case SMI_GAUGE:
case SMI_TIMETICKS:
case SMI_UINTEGER:
vp->val.integer = (long *)malloc(sizeof(long));
vp->val_len = sizeof(long);
asn_parse_unsigned_int(var_val, &len, &vp->type, (unsigned long
*)vp->val.integer, sizeof(vp->val.integer));
break;
”
the function named “asn_parse_int” last param should be
sizeof(*(vp->val.integer) ), but I found just before this code , when “
asn_parse_int” decode the version , error code , error status , the last
param is correct . please check it.
Because the system “tru64” is a 64 bits OS, sizeof( * int ) = 8 , sizeof(
int) /sizeof(long)= 4, so I can foud this bug.
But in 32 bits OS , sizeof( * int) = sizeof(int)=4 , so code can pass.
I also found in snmp++ 3.2 has same bug .
_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
More information about the AGENTPP
mailing list