summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/__strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/__strerror.c')
-rw-r--r--src/lib/libc/string/__strerror.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/libc/string/__strerror.c b/src/lib/libc/string/__strerror.c
index 9c023f8a53..04fdce580a 100644
--- a/src/lib/libc/string/__strerror.c
+++ b/src/lib/libc/string/__strerror.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35static char *rcsid = "$OpenBSD: __strerror.c,v 1.6 1996/09/25 08:17:30 deraadt Exp $"; 35static char *rcsid = "$OpenBSD: __strerror.c,v 1.7 2001/06/27 00:58:56 lebel Exp $";
36#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
37 37
38#ifdef NLS 38#ifdef NLS
@@ -87,16 +87,14 @@ __strerror(num, buf)
87 errnum = num; /* convert to unsigned */ 87 errnum = num; /* convert to unsigned */
88 if (errnum < sys_nerr) { 88 if (errnum < sys_nerr) {
89#ifdef NLS 89#ifdef NLS
90 strncpy(buf, catgets(catd, 1, errnum, 90 strlcpy(buf, catgets(catd, 1, errnum,
91 (char *)sys_errlist[errnum]), NL_TEXTMAX-1); 91 (char *)sys_errlist[errnum]), NL_TEXTMAX);
92 buf[NL_TEXTMAX - 1] = '\0';
93#else 92#else
94 return(sys_errlist[errnum]); 93 return(sys_errlist[errnum]);
95#endif 94#endif
96 } else { 95 } else {
97#ifdef NLS 96#ifdef NLS
98 strncpy(buf, catgets(catd, 1, 0xffff, UPREFIX), NL_TEXTMAX-1); 97 strlcpy(buf, catgets(catd, 1, 0xffff, UPREFIX), NL_TEXTMAX);
99 buf[NL_TEXTMAX - 1] = '\0';
100#else 98#else
101 strcpy(buf, UPREFIX); 99 strcpy(buf, UPREFIX);
102#endif 100#endif