diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-26 23:31:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-26 23:31:27 +0000 |
commit | 01b4cd2f45a8e235a32d16ef34456f8b55cb6a73 (patch) | |
tree | 3c66b1fb58ce07a953a8488152833d0ebe5afb0a /bin/date | |
parent | 09f09388c319469ee9759cb9555aa16d56d4e570 (diff) |
strncpy careful
Diffstat (limited to 'bin/date')
-rw-r--r-- | bin/date/netdate.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/date/netdate.c b/bin/date/netdate.c index da7b8d94af9..b3670155acb 100644 --- a/bin/date/netdate.c +++ b/bin/date/netdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdate.c,v 1.3 1996/08/04 15:45:26 deraadt Exp $ */ +/* $OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 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.3 1996/08/04 15:45:26 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -114,7 +114,8 @@ netsettime(tval) warn("gethostname"); goto bad; } - (void)strncpy(msg.tsp_name, hostname, sizeof(hostname)); + (void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name)); + 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); msg.tsp_time.tv_usec = htonl((u_long)0); |