X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/be37dfa4622c8f9b8f3dec9c8f2b0b891dd95d3a..600590726828c6d6be4c6cb57718574430e36765:/print-snmp.c diff --git a/print-snmp.c b/print-snmp.c index aa8d78f0..70127c69 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -58,7 +58,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.50 2001-09-17 22:16:53 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.51 2002-05-07 07:39:05 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -688,13 +688,17 @@ asn1_print(struct be *elem) /* * first subitem encodes two items with 1st*OIDMUX+2nd + * (see X.690:1997 clause 8.19 for the details) */ if (first < 0) { + int s; if (!nflag) objp = mibroot; first = 0; - OBJ_PRINT(o/OIDMUX, first); - o %= OIDMUX; + s = o / OIDMUX; + if (s > 2) s = 2; + OBJ_PRINT(s, first); + o -= s * OIDMUX; } OBJ_PRINT(o, first); if (--first < 0) @@ -875,16 +879,19 @@ static void smi_decode_oid(struct be *elem, unsigned int *oid, /* * first subitem encodes two items with 1st*OIDMUX+2nd + * (see X.690:1997 clause 8.19 for the details) */ if (first < 0) { first = 0; if (*oidlen < oidsize) { - oid[(*oidlen)++] = o/OIDMUX; + oid[*oidlen] = o / OIDMUX; + if (oid[*oidlen] > 2) oid[*oidlen] = 2; } - o %= OIDMUX; + o -= oid[*oidlen] * OIDMUX; + if (*oidlen < oidsize) (*oidlen)++; } if (*oidlen < oidsize) { - oid[(*oidlen)++] = o; + oid[(*oidlen)++] = o; } o = 0; }