Browse Source

correct strlcpy abuse

ok millert@
OPENBSD_3_8
beck 19 years ago
parent
commit
e432cee459
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      src/lib/libc/string/strerror_r.c

+ 8
- 4
src/lib/libc/string/strerror_r.c View File

@ -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


Loading…
Cancel
Save