]> git.cameronkatri.com Git - mandoc.git/commitdiff
The previous commit to this file broke the control flow keywords \{ and \}
authorIngo Schwarze <schwarze@openbsd.org>
Tue, 1 Jul 2014 00:32:29 +0000 (00:32 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Tue, 1 Jul 2014 00:32:29 +0000 (00:32 +0000)
when they immediately follow a request or macro name, without intervening
whitespace.  Minimal fix.

The lesson learnt here is that, despite their appearance, \{ and \} are
not escape sequences, so never skip them when parsing for names.

roff.c

diff --git a/roff.c b/roff.c
index 511a2cff793f5df85d7ee77652dcd4fe94fc133f..465bba79fabee5d5cf8b5ccc41b56f0de110242d 100644 (file)
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/*     $Id: roff.c,v 1.214 2014/06/29 23:26:00 schwarze Exp $ */
+/*     $Id: roff.c,v 1.215 2014/07/01 00:32:29 schwarze Exp $ */
 /*
  * Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -2018,10 +2018,12 @@ roff_getname(struct roff *r, char **cpp, int ln, int pos)
                }
                if ('\\' != *cp)
                        continue;
+               namesz = cp - name;
+               if ('{' == cp[1] || '}' == cp[1])
+                       break;
                cp++;
                if ('\\' == *cp)
                        continue;
-               namesz = cp - name - 1;
                mandoc_msg(MANDOCERR_NAMESC, r->parse, ln, pos, NULL);
                mandoc_escape((const char **)&cp, NULL, NULL);
                break;