diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-01-10 13:54:34 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-01-10 13:54:34 +0000 |
commit | 2b77087a48ea56e77fca5aeab478c922f6473d7c (patch) | |
tree | 31c59d95ad846eb483672848c940b7eace0779a8 /newlib/libc/stdlib | |
parent | f1817d368a9242d2e6473da9003f4a4a908cf1e7 (diff) | |
download | newlib-2b77087a48ea56e77fca5aeab478c922f6473d7c.zip newlib-2b77087a48ea56e77fca5aeab478c922f6473d7c.tar.gz newlib-2b77087a48ea56e77fca5aeab478c922f6473d7c.tar.bz2 |
* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of
non-ASCII chars on Cygwin.
* libc/stdlib/wctomb_r.c (__ascii_wctomb): Ditto.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r-- | newlib/libc/stdlib/mbtowc_r.c | 8 | ||||
-rw-r--r-- | newlib/libc/stdlib/wctomb_r.c | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index 863404f..f161385 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -47,6 +47,14 @@ _DEFUN (__ascii_mbtowc, (r, pwc, s, n, charset, state), if (n == 0) return -2; +#ifdef __CYGWIN__ + if ((wchar_t)*t >= 0x80) + { + r->_errno = EILSEQ; + return -1; + } +#endif + *pwc = (wchar_t)*t; if (*t == '\0') diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 2c462ba..d1ee497 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -40,7 +40,11 @@ _DEFUN (__ascii_wctomb, (r, s, wchar, charset, state), if (s == NULL) return 0; +#ifdef __CYGWIN__ + if ((size_t)wchar >= 0x80) +#else if ((size_t)wchar >= 0x100) +#endif { r->_errno = EILSEQ; return -1; |