]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-decnet.c
Check for parse failure in ACCESS replies.
[tcpdump] / print-decnet.c
index 6188bf75924d81a741eeda5d21327b7d4d43c1ae..bb5f075f801d2745a531424906a6ed04e5f743c0 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.26 1999-10-07 23:47:11 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.32 2001-01-28 08:06:06 itojun Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
 
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/socket.h>
 
-#if __STDC__
 struct mbuf;
 struct rtentry;
-#endif
-#include <net/if.h>
 
 #ifdef HAVE_LIBDNET
 #include <netdnet/dnetdb.h>
 #endif
 
 #include <ctype.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -736,13 +734,14 @@ char *
 dnnum_string(u_short dnaddr)
 {
        char *str;
+       size_t siz;
        int area = (u_short)(dnaddr & AREAMASK) >> AREASHIFT;
        int node = dnaddr & NODEMASK;
 
-       str = (char *)malloc(sizeof("00.0000"));
+       str = (char *)malloc(siz = sizeof("00.0000"));
        if (str == NULL)
                error("dnnum_string: malloc");
-       sprintf(str, "%d.%d", area, node);
+       snprintf(str, siz, "%d.%d", area, node);
        return(str);
 }
 
@@ -754,7 +753,7 @@ dnname_string(u_short dnaddr)
 
        dna.a_len = sizeof(short);
        memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short));
-       return (savestr(dnet_htoa(&dna)));
+       return (strdup(dnet_htoa(&dna)));
 #else
        return(dnnum_string(dnaddr));   /* punt */
 #endif
@@ -769,10 +768,7 @@ pdata(u_char *dp, u_int maxlen)
 
        while (x-- > 0) {
            c = *dp++;
-           if (isprint(c))
-               putchar(c);
-           else
-               printf("\\%o", c & 0xFF);
+           safeputchar(c);
        }
 }
 #endif