summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/string/strerror_r.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libc/string/strerror_r.c b/lib/libc/string/strerror_r.c
index db264bcf505..c0ca434cbde 100644
--- a/lib/libc/string/strerror_r.c
+++ b/lib/libc/string/strerror_r.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: strerror_r.c,v 1.2 2004/05/03 05:07:34 espie Exp $ */
+/* $OpenBSD: strerror_r.c,v 1.3 2005/04/20 23:38:15 beck Exp $ */
/* Public Domain <marc@snafu.org> */
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strerror_r.c,v 1.2 2004/05/03 05:07:34 espie Exp $";
+static char *rcsid = "$OpenBSD: strerror_r.c,v 1.3 2005/04/20 23:38:15 beck Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef NLS
@@ -107,8 +107,12 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen)
#else
len = strlcpy(strerrbuf, UPREFIX, buflen);
#endif
- __itoa(errnum, strerrbuf, len, buflen);
- ret_errno = EINVAL;
+ if (len >= buflen)
+ ret_errno = ERANGE;
+ else {
+ __itoa(errnum, strerrbuf, len, buflen);
+ ret_errno = EINVAL;
+ }
}
#ifdef NLS