summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1998-02-16 11:27:15 +0000
committerlukem <lukem@NetBSD.org>1998-02-16 11:27:15 +0000
commitc197a64bba9102ce987fe6364bccfdb72f3e3352 (patch)
treefb8b53fa32cea90afd4a8fe8045b5cfe80ab18c6 /lib/libc/string
parent509f891bd002f96b16b49da71de0e9a6dc61b8db (diff)
don't assume buf is NL_TEXTMAX long
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/__strerror.c10
-rw-r--r--lib/libc/string/strerror.c6
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/string/__strerror.c b/lib/libc/string/__strerror.c
index d5d898ac3a3..2b9aeddd45d 100644
--- a/lib/libc/string/__strerror.c
+++ b/lib/libc/string/__strerror.c
@@ -1,4 +1,4 @@
-/* $NetBSD: __strerror.c,v 1.11 1998/02/03 18:49:08 perry Exp $ */
+/* $NetBSD: __strerror.c,v 1.12 1998/02/16 11:27:16 lukem Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -38,7 +38,7 @@
#if 0
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#else
-__RCSID("$NetBSD: __strerror.c,v 1.11 1998/02/03 18:49:08 perry Exp $");
+__RCSID("$NetBSD: __strerror.c,v 1.12 1998/02/16 11:27:16 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -77,14 +77,14 @@ __strerror(num, buf, buflen)
if (errnum < sys_nerr) {
#ifdef NLS
strncpy(buf, catgets(catd, 1, errnum,
- (char *)sys_errlist[errnum]), NL_TEXTMAX);
- buf[NL_TEXTMAX - 1] = '\0';
+ (char *)sys_errlist[errnum]), buflen);
+ buf[buflen - 1] = '\0';
#else
return(sys_errlist[errnum]);
#endif
} else {
#ifdef NLS
- snprintf(buf, NL_TEXTMAX,
+ snprintf(buf, buflen,
catgets(catd, 1, 0xffff, UPREFIX), errnum);
#else
snprintf(buf, buflen, UPREFIX, errnum);
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c
index d93166ea6e7..bc02b1587d1 100644
--- a/lib/libc/string/strerror.c
+++ b/lib/libc/string/strerror.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strerror.c,v 1.7 1997/07/13 20:24:25 christos Exp $ */
+/* $NetBSD: strerror.c,v 1.8 1998/02/16 11:27:16 lukem Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -38,7 +38,7 @@
#if 0
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#else
-__RCSID("$NetBSD: strerror.c,v 1.7 1997/07/13 20:24:25 christos Exp $");
+__RCSID("$NetBSD: strerror.c,v 1.8 1998/02/16 11:27:16 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -58,5 +58,5 @@ strerror(num)
{
static char buf[NL_TEXTMAX];
- return __strerror(num, buf, NL_TEXTMAX);
+ return __strerror(num, buf, sizeof(buf));
}