summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/ping/ping.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 3545c31..de19a45 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -959,9 +959,10 @@ pr_addr(l)
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);
}
OpenPOWER on IntegriCloud