X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b9ac23ce92ca22483d56ee3192c54aa8f782f9ac..4890d02f2cbdfd68f0dfb8ce7123fb61b4a591d4:/print-decnet.c?ds=sidebyside diff --git a/print-decnet.c b/print-decnet.c index aefca10a..bb5f075f 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.27 1999-11-21 09:36:50 fenner 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 @@ -32,20 +32,14 @@ static const char rcsid[] = #include #include -#if __STDC__ struct mbuf; struct rtentry; -#endif -#include #ifdef HAVE_LIBDNET #include #endif #include -#ifdef HAVE_MALLOC_H -#include -#endif #include #include #include @@ -740,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); } @@ -758,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 @@ -773,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