From 6db70e14296940bab12a142d384433d0d4cbf9c4 Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 26 Mar 1997 19:08:06 +0000 Subject: [PATCH] more careful strncpy --- bin/date/netdate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/date/netdate.c b/bin/date/netdate.c index 28b4768a26a..3e68bc182c5 100644 --- a/bin/date/netdate.c +++ b/bin/date/netdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdate.c,v 1.5 1996/12/14 12:17:45 mickey Exp $ */ +/* $OpenBSD: netdate.c,v 1.6 1997/03/26 19:08:06 deraadt 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.5 1996/12/14 12:17:45 mickey Exp $"; +static char rcsid[] = "$OpenBSD: netdate.c,v 1.6 1997/03/26 19:08:06 deraadt Exp $"; #endif #endif /* not lint */ @@ -115,7 +115,7 @@ netsettime(tval) warn("gethostname"); goto bad; } - (void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name)); + (void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name)-1); msg.tsp_name[sizeof(msg.tsp_name)-1] = '\0'; msg.tsp_seq = htons((u_short)0); msg.tsp_time.tv_sec = htonl((u_long)tval); -- 2.20.1