summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/addrtoname.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
committerfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
commitace14a2b50f2cc05c079d0b9137b49066dbb1206 (patch)
tree4953fdd47c44b8ec88d34a4db7b698841365e22f /contrib/tcpdump/addrtoname.c
parent54c4a9c9f2aca2e032cbf41f5eb012e2e9628dd4 (diff)
downloadFreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.zip
FreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.tar.gz
Virgin import of tcpdump.org tcpdump v3.6.2
Diffstat (limited to 'contrib/tcpdump/addrtoname.c')
-rw-r--r--contrib/tcpdump/addrtoname.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index 70c70cf..600b329 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -23,7 +23,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.64 1999/11/21 09:36:44 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.69.2.1 2001/01/17 18:29:58 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -34,17 +34,13 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <sys/time.h>
-#if __STDC__
struct mbuf;
struct rtentry;
-#endif
#include <net/if.h>
#include <netinet/in.h>
+#ifdef HAVE_NETINET_IF_ETHER_H
#include <netinet/if_ether.h>
-
-#ifdef INET6
-#include <netinet6/ip6.h>
#endif
#include <arpa/inet.h>
@@ -53,12 +49,6 @@ struct rtentry;
#include <netdb.h>
#include <pcap.h>
#include <pcap-namedb.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
#include <signal.h>
#include <stdio.h>
#include <string.h>
@@ -495,7 +485,6 @@ protoid_string(register const u_char *pi)
char *
llcsap_string(u_char sap)
{
- register char *cp;
register struct hnamemem *tp;
register u_int32_t i = sap;
char buf[sizeof("sap 00")];
@@ -507,12 +496,7 @@ llcsap_string(u_char sap)
tp->addr = i;
tp->nxt = newhnamemem();
- cp = buf;
- (void)strcpy(cp, "sap ");
- cp += strlen(cp);
- *cp++ = hex[sap >> 4 & 0xf];
- *cp++ = hex[sap & 0xf];
- *cp++ = '\0';
+ snprintf(buf, sizeof(buf), "sap %02x", sap & 0xff);
tp->name = savestr(buf);
return (tp->name);
}
@@ -556,7 +540,7 @@ tcpport_string(u_short port)
tp->addr = i;
tp->nxt = newhnamemem();
- (void)sprintf(buf, "%u", i);
+ (void)snprintf(buf, sizeof(buf), "%u", i);
tp->name = savestr(buf);
return (tp->name);
}
@@ -575,7 +559,7 @@ udpport_string(register u_short port)
tp->addr = i;
tp->nxt = newhnamemem();
- (void)sprintf(buf, "%u", i);
+ (void)snprintf(buf, sizeof(buf), "%u", i);
tp->name = savestr(buf);
return (tp->name);
}
@@ -601,7 +585,7 @@ init_servarray(void)
while (table->name)
table = table->nxt;
if (nflag) {
- (void)sprintf(buf, "%d", port);
+ (void)snprintf(buf, sizeof(buf), "%d", port);
table->name = savestr(buf);
} else
table->name = savestr(sv->s_name);
OpenPOWER on IntegriCloud