]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-snmp.c
Merge pull request #328 from darkjames/master
[tcpdump] / print-snmp.c
index bab18da75c7c7b95dc4d9d5d97681c6b536a6f1b..728da6beb79ebca0bdeac14455d50173676bd2fa 100644 (file)
@@ -58,7 +58,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.61 2004-12-27 22:14:12 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.64 2005-05-06 07:56:53 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -786,7 +786,10 @@ asn1_print(struct be *elem)
                p = elem->data.str;
                if (printable) {
                        putchar('"');
-                       (void)fn_print(p, p + asnlen);
+                       if (fn_printn(p, asnlen, snapend)) {
+                               putchar('"');
+                               goto trunc;
+                       }
                        putchar('"');
                } else
                        for (i = asnlen; i-- > 0; p++) {
@@ -1025,7 +1028,7 @@ static SmiNode *smi_print_variable(struct be *elem, int *status)
 {
        unsigned int oid[128], oidlen;
        SmiNode *smiNode = NULL;
-       int i;
+       unsigned int i;
 
        *status = smi_decode_oid(elem, oid, sizeof(oid)/sizeof(unsigned int),
            &oidlen);
@@ -1053,10 +1056,10 @@ static SmiNode *smi_print_variable(struct be *elem, int *status)
 static int
 smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
 {
-       unsigned int oid[128], oidlen;
+       unsigned int i, oid[128], oidlen;
        SmiType *smiType;
        SmiNamedNumber *nn;
-       int i, done = 0;
+       int done = 0;
 
        if (! smiNode || ! (smiNode->nodekind
                            & (SMI_NODEKIND_SCALAR | SMI_NODEKIND_COLUMN))) {
@@ -1290,7 +1293,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
  * GetBulk, Inform, V2Trap, and Report
  */
 static void
-snmppdu_print(u_char pduid, const u_char *np, u_int length)
+snmppdu_print(u_short pduid, const u_char *np, u_int length)
 {
        struct be elem;
        int count = 0, error;
@@ -1320,13 +1323,13 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length)
        if ((pduid == GETREQ || pduid == GETNEXTREQ || pduid == SETREQ
            || pduid == INFORMREQ || pduid == V2TRAP || pduid == REPORT)
            && elem.data.integer != 0) {
-               char errbuf[10];
+               char errbuf[20];
                printf("[errorStatus(%s)!=0]",
                        DECODE_ErrorStatus(elem.data.integer));
        } else if (pduid == GETBULKREQ) {
                printf(" N=%d", elem.data.integer);
        } else if (elem.data.integer != 0) {
-               char errbuf[10];
+               char errbuf[20];
                printf(" %s", DECODE_ErrorStatus(elem.data.integer));
                error = elem.data.integer;
        }
@@ -1415,7 +1418,7 @@ trappdu_print(const u_char *np, u_int length)
        }
        generic = elem.data.integer;
        {
-               char buf[10];
+               char buf[20];
                printf(" %s", DECODE_GenericTrap(generic));
        }
        length -= count;