X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/bc80934db614d28c7b53a0b013dd68c4e6234c7e..9132cdb1bf9e6566ff6580d49fc26cf87afa976a:/mandoc.c

diff --git a/mandoc.c b/mandoc.c
index 249a0dea..465965a4 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,4 +1,4 @@
-/*	$Id: mandoc.c,v 1.50 2011/05/14 16:06:09 kristaps Exp $ */
+/*	$Id: mandoc.c,v 1.53 2011/05/24 21:31:23 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -125,6 +125,14 @@ mandoc_escape(const char **end, const char **start, int *sz)
 		break;
 	case ('['):
 		gly = ESCAPE_SPECIAL;
+		/*
+		 * Unicode escapes are defined in groff as \[uXXXX] to
+		 * \[u10FFFF], where the contained value must be a valid
+		 * Unicode codepoint.  Here, however, only check whether
+		 * it's not a zero-width escape.
+		 */
+		if ('u' == cp[i] && ']' != cp[i + 1])
+			gly = ESCAPE_UNICODE;
 		term = ']';
 		break;
 	case ('C'):
@@ -156,10 +164,6 @@ mandoc_escape(const char **end, const char **start, int *sz)
 		if (ESCAPE_ERROR == gly)
 			gly = ESCAPE_IGNORE;
 		/* FALLTHROUGH */
-	case ('*'):
-		if (ESCAPE_ERROR == gly)
-			gly = ESCAPE_PREDEF;
-		/* FALLTHROUGH */
 	case ('f'):
 		if (ESCAPE_ERROR == gly)
 			gly = ESCAPE_FONT;
@@ -704,7 +708,7 @@ mandoc_strntou(const char *p, size_t sz, int base)
 		return(-1);
 
 	memcpy(buf, p, sz);
-	buf[sz] = '\0';
+	buf[(int)sz] = '\0';
 
 	errno = 0;
 	v = strtol(buf, &ep, base);