diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-10-25 13:24:45 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-10-25 13:24:45 +0000 |
| commit | 583efa1268dfc7b55ec568903d4fd8027ec7db0f (patch) | |
| tree | 172381160da385b0472ee430a06b3b8e51553641 /lib/libc | |
| parent | ddc4f28155077c171dd10677feeffffb4ff9a48b (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/locale/wcrtomb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/locale/wcrtomb.c b/lib/libc/locale/wcrtomb.c index 116dce52c81e..a76f03159386 100644 --- a/lib/libc/locale/wcrtomb.c +++ b/lib/libc/locale/wcrtomb.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> +#include <limits.h> #include <rune.h> #include <stdlib.h> #include <wchar.h> @@ -36,7 +37,10 @@ size_t wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps __unused) { char *e; + char buf[MB_LEN_MAX]; + if (s == NULL) + s = buf; sputrune(wc, s, MB_CUR_MAX, &e); if (e == NULL) { errno = EILSEQ; |
