diff options
author | lebel <lebel@cvs.openbsd.org> | 2001-06-26 14:33:26 +0000 |
---|---|---|
committer | lebel <lebel@cvs.openbsd.org> | 2001-06-26 14:33:26 +0000 |
commit | d1f8e92329b017f37529366deb0d18a5f9cd96a9 (patch) | |
tree | cb19b48dab6d11c362f02754e6b243a8c5e53a5d | |
parent | e18c93f19f53552be2829b87f64f87ee79206eb5 (diff) |
use strlcpy vs strncpy+a[len-1]='\0'
-rw-r--r-- | bin/date/netdate.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bin/date/netdate.c b/bin/date/netdate.c index d240ef25daf..160afbbcf8c 100644 --- a/bin/date/netdate.c +++ b/bin/date/netdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdate.c,v 1.10 1997/09/01 18:29:22 deraadt Exp $ */ +/* $OpenBSD: netdate.c,v 1.11 2001/06/26 14:33:25 lebel Exp $ */ /* $NetBSD: netdate.c,v 1.10 1995/09/07 06:21:06 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netdate.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: netdate.c,v 1.10 1997/09/01 18:29:22 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: netdate.c,v 1.11 2001/06/26 14:33:25 lebel Exp $"; #endif #endif /* not lint */ @@ -117,8 +117,7 @@ netsettime(tval) warn("gethostname"); goto bad; } - (void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name)-1); - msg.tsp_name[sizeof(msg.tsp_name)-1] = '\0'; + (void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name)); msg.tsp_seq = htons((u_short)0); msg.tsp_time.tv_sec = htonl((u_long)tval); msg.tsp_time.tv_usec = htonl((u_long)0); |