diff options
author | bapt <bapt@FreeBSD.org> | 2015-08-09 10:36:25 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-08-09 10:36:25 +0000 |
commit | 4f14f063cfe3d3f206f765549c6026fb89af9958 (patch) | |
tree | 5aa3b022300e2b77240a0fdf46ef1bcc19200df5 /lib/libc | |
parent | 32118b1361e1aa745c976e0e46503cdf0a063c45 (diff) | |
download | FreeBSD-src-4f14f063cfe3d3f206f765549c6026fb89af9958.zip FreeBSD-src-4f14f063cfe3d3f206f765549c6026fb89af9958.tar.gz |
Readd checking utf16 surrogates that are invalid in utf8
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/locale/utf8.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index 02b1ccc..11e7825 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -193,6 +193,13 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, errno = EILSEQ; return ((size_t)-1); } + if (wch >= 0xd800 && wch <= 0xdfff) { + /* + * Malformed input; invalid code points. + */ + errno = EILSEQ; + return ((size_t)-1); + } if (pwc != NULL) *pwc = wch; us->want = 0; |