summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-09-05 13:29:39 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-09-05 13:29:39 +0000
commit5f21e2b5b73e5d1945fb5f7f711a569bf6601015 (patch)
tree6df41ba2634d76dbcd9dbddc990054daccb13516 /lib/libc
parentf7d3ba444c20392860737583862849a36210d3b7 (diff)
check for limiting the range of UTF-8 to 0x10FFFF, as requested by RFC 3629.
ok stsp@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/citrus/citrus_utf8.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libc/citrus/citrus_utf8.c b/lib/libc/citrus/citrus_utf8.c
index 72abf0ce5b9..f8bce9b5cf6 100644
--- a/lib/libc/citrus/citrus_utf8.c
+++ b/lib/libc/citrus/citrus_utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: citrus_utf8.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: citrus_utf8.c,v 1.9 2015/09/05 13:29:38 semarie Exp $ */
/*-
* Copyright (c) 2002-2004 Tim J. Robbins
@@ -169,6 +169,13 @@ _citrus_utf8_ctype_mbrtowc(wchar_t * __restrict pwc,
errno = EILSEQ;
return ((size_t)-1);
}
+ if (wch >= 0x10ffff) {
+ /*
+ * Malformed input; invalid code points.
+ */
+ errno = EILSEQ;
+ return ((size_t)-1);
+ }
if (pwc != NULL)
*pwc = wch;
us->want = 0;