summaryrefslogtreecommitdiff
path: root/sbin/ping/ping.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-22 21:12:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-22 21:12:24 +0000
commit531304824736a0a4a97331ce4a0cf9370549c82c (patch)
treeb0dae973c6f7fb83d2abb0d1508861f7f541435a /sbin/ping/ping.c
parent4eb856b7fddedb91ffa0626be96ec485d890cd05 (diff)
no overflow; from brian@saturn.net
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r--sbin/ping/ping.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index a800b58e197..6238501b403 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.3 1996/06/23 14:32:02 deraadt Exp $ */
+/* $OpenBSD: ping.c,v 1.4 1996/07/22 21:12:23 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: ping.c,v 1.3 1996/06/23 14:32:02 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ping.c,v 1.4 1996/07/22 21:12:23 deraadt Exp $";
#endif
#endif /* not lint */
@@ -1012,13 +1012,14 @@ pr_addr(l)
u_long l;
{
struct hostent *hp;
- static char buf[80];
+ static char buf[16+3+MAXHOSTNAMELEN];
if ((options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&l, 4, AF_INET)))
- (void)sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&l));
+ (void)snprintf(buf, sizeof buf, "%s",
+ inet_ntoa(*(struct in_addr *)&l));
else
- (void)sprintf(buf, "%s (%s)", hp->h_name,
+ (void)snprintf(buf, sizeof buf, "%s (%s)", hp->h_name,
inet_ntoa(*(struct in_addr *)&l));
return(buf);
}