]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-decnet.c
Patch from Pekka Savola <[email protected]> to keep from dragging in our
[tcpdump] / print-decnet.c
index aefca10a0beb7615650b769510e18cf9cc7d7659..16d0ee0c56ff98c806713b11cfb19e960a47f0a3 100644 (file)
@@ -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.30 2000-09-28 06:42:57 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -32,20 +32,14 @@ static const char rcsid[] =
 #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>
@@ -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);
 }