diff options
author | 2001-06-27 00:58:53 +0000 | |
---|---|---|
committer | 2001-06-27 00:58:53 +0000 | |
commit | f1a075da3e4bb4f84a5bb83783c6b1943dc3da49 (patch) | |
tree | f3b98ca6be26aa2b00a7770f1dceff5312265655 /lib/libc/string/__strerror.c | |
parent | Keep track of the ACQUIRE sequence number, and pass it to the kernel (diff) | |
download | wireguard-openbsd-f1a075da3e4bb4f84a5bb83783c6b1943dc3da49.tar.xz wireguard-openbsd-f1a075da3e4bb4f84a5bb83783c6b1943dc3da49.zip |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'lib/libc/string/__strerror.c')
-rw-r--r-- | lib/libc/string/__strerror.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/string/__strerror.c b/lib/libc/string/__strerror.c index 9c023f8a534..04fdce580a4 100644 --- a/lib/libc/string/__strerror.c +++ b/lib/libc/string/__strerror.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: __strerror.c,v 1.6 1996/09/25 08:17:30 deraadt Exp $"; +static char *rcsid = "$OpenBSD: __strerror.c,v 1.7 2001/06/27 00:58:56 lebel Exp $"; #endif /* LIBC_SCCS and not lint */ #ifdef NLS @@ -87,16 +87,14 @@ __strerror(num, buf) errnum = num; /* convert to unsigned */ if (errnum < sys_nerr) { #ifdef NLS - strncpy(buf, catgets(catd, 1, errnum, - (char *)sys_errlist[errnum]), NL_TEXTMAX-1); - buf[NL_TEXTMAX - 1] = '\0'; + strlcpy(buf, catgets(catd, 1, errnum, + (char *)sys_errlist[errnum]), NL_TEXTMAX); #else return(sys_errlist[errnum]); #endif } else { #ifdef NLS - strncpy(buf, catgets(catd, 1, 0xffff, UPREFIX), NL_TEXTMAX-1); - buf[NL_TEXTMAX - 1] = '\0'; + strlcpy(buf, catgets(catd, 1, 0xffff, UPREFIX), NL_TEXTMAX); #else strcpy(buf, UPREFIX); #endif |