diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-12-21 00:25:18 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-12-21 00:25:18 +0000 |
commit | 86b849602493676951a2748afee693bfc866b8ea (patch) | |
tree | 6e6f59bfec8ada9bba6ace8e11f4cb7b7d915685 /sbin/ping/ping.c | |
parent | 9dd5d8a00e3f4635ccb0310ada2e4b6a74367721 (diff) |
use strlcpy
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index d78cd887fe9..4dc74b97c3c 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.41 2000/01/22 20:25:04 deraadt Exp $ */ +/* $OpenBSD: ping.c,v 1.42 2000/12/21 00:25:17 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.41 2000/01/22 20:25:04 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ping.c,v 1.42 2000/12/21 00:25:17 deraadt Exp $"; #endif #endif /* not lint */ @@ -346,8 +346,7 @@ main(argc, argv) errx(1, "unknown host: %s", target); to->sin_family = hp->h_addrtype; memcpy(&to->sin_addr, hp->h_addr, hp->h_length); - (void)strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf) - 1); - hnamebuf[sizeof(hnamebuf) - 1] = '\0'; + (void)strlcpy(hnamebuf, hp->h_name, sizeof(hnamebuf)); hostname = hnamebuf; } |