summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index 2ee06873..140673e1 100644
--- a/roff.c
+++ b/roff.c
@@ -404,6 +404,7 @@ roff_alloc(struct mparse *parse)
static int
roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
{
+ enum mandoc_esc esc;
const char *stesc; /* start of an escape sequence ('\\') */
const char *stnam; /* start of the name, after "[(*" */
const char *cp; /* end of the name, e.g. before ']' */
@@ -426,8 +427,19 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
if ('\0' == *cp)
return(1);
- if ('*' != *cp++)
+
+ if ('*' != *cp) {
+ res = cp;
+ esc = mandoc_escape(&cp, NULL, NULL);
+ if (ESCAPE_ERROR != esc)
+ continue;
+ mandoc_msg(MANDOCERR_BADESCAPE,
+ r->parse, ln, pos, NULL);
+ cp = res;
continue;
+ }
+
+ cp++;
/*
* The third character decides the length