summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-08-27 12:59:02 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-08-27 12:59:02 +0000
commit817c9ebe02e8e98d07a0081313a87c1996ef3246 (patch)
tree9b1bd364051a8f1a68a159daeb1b95ec6e9cb35f /roff.c
parent6f26336e1989358418dea0298b76c51b63066948 (diff)
downloadmandoc-817c9ebe02e8e98d07a0081313a87c1996ef3246.tar.gz
Avoid artifacts in the most common case of closing conditional blocks
when no arguments follow the closing brace, \}. For example, the line "'br\}" contained in the pod2man(1) preamble would throw a bogus "escaped character not allowed in a name" error. This issue was originally reported by Chris Bennett on ports@, and afresh1@ noticed it came from the pod2man(1) preamble.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index aabad625..3d0ff481 100644
--- a/roff.c
+++ b/roff.c
@@ -2362,7 +2362,9 @@ roff_cond_checkend(ROFF_ARGS)
while ((ep = strchr(ep, '\\')) != NULL) {
switch (ep[1]) {
case '}':
- if (rr)
+ if (ep[2] == '\0')
+ ep[0] = '\0';
+ else if (rr)
ep[1] = '&';
else
memmove(ep, ep + 2, strlen(ep + 2) + 1);