aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/chars.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-28 13:24:44 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-28 13:24:44 +0000
commit747bf8062cca375c58d984004718a2351a88daed (patch)
treec6a09911f1ddd799d8fc34009ce98e10bab9ad77 /chars.c
parent7f43f205b47aa5a68d76c5c14c3d5bb261df1cff (diff)
downloadmandoc-747bf8062cca375c58d984004718a2351a88daed.tar.gz
mandoc-747bf8062cca375c58d984004718a2351a88daed.tar.zst
mandoc-747bf8062cca375c58d984004718a2351a88daed.zip
Tighten Unicode escape name parsing.
Accept only 0xXXXX, 0xYXXXX, 0x10XXXX with Y != 0. This simplifies mchars_num2uc().
Diffstat (limited to 'chars.c')
-rw-r--r--chars.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/chars.c b/chars.c
index 8c99d0a0..6d26208d 100644
--- a/chars.c
+++ b/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.62 2014/10/27 13:31:04 schwarze Exp $ */
+/* $Id: chars.c,v 1.63 2014/10/28 13:24:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -123,14 +123,9 @@ mchars_num2uc(const char *p, size_t sz)
{
int i;
- if ((i = mandoc_strntoi(p, sz, 16)) < 0)
- return(0xFFFD);
-
- /*
- * XXX Code is missing here to exclude bogus ranges.
- */
-
- return(i <= 0x10FFFF ? i : 0xFFFD);
+ i = mandoc_strntoi(p, sz, 16);
+ assert(i >= 0 && i <= 0x10FFFF);
+ return(i);
}
const char *