diff options
author | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
---|---|---|
committer | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
commit | 8af9ac2691950c45385aecf7c502a16c3c11db86 (patch) | |
tree | 2b4161da48e1261faa9895ae08bd1fcdf3be38a3 /lib/libc/time/localtime.c | |
parent | c5355883f033c52fa97b73febb89e80adf21cbbd (diff) |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'lib/libc/time/localtime.c')
-rw-r--r-- | lib/libc/time/localtime.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c index 399d53802f0..106103ad80c 100644 --- a/lib/libc/time/localtime.c +++ b/lib/libc/time/localtime.c @@ -5,7 +5,7 @@ #if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID) static char elsieid[] = "@(#)localtime.c 7.70"; -static char rcsid[] = "$OpenBSD: localtime.c,v 1.19 2000/04/16 16:24:03 d Exp $"; +static char rcsid[] = "$OpenBSD: localtime.c,v 1.20 2001/06/27 00:58:57 lebel Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -904,12 +904,10 @@ const int lastditch; if ((size_t) sp->charcnt > sizeof sp->chars) return -1; cp = sp->chars; - (void) strncpy(cp, stdname, stdlen); - cp += stdlen; - *cp++ = '\0'; + strlcpy(cp, stdname, stdlen + 1); + cp += stdlen + 1; if (dstlen != 0) { - (void) strncpy(cp, dstname, dstlen); - *(cp + dstlen) = '\0'; + strlcpy(cp, dstname, dstlen + 1); } return 0; } |