diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-08-27 12:59:02 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-08-27 12:59:02 +0000 |
commit | 10c7195ae21b46c15b20ccb55be6aea83b9cb237 (patch) | |
tree | dfd6898dd6b27ad569c49b8559541ecafe385ec8 | |
parent | bd916969316991bf751b102b53c2a26febb13487 (diff) | |
download | mandoc-10c7195ae21b46c15b20ccb55be6aea83b9cb237.tar.gz mandoc-10c7195ae21b46c15b20ccb55be6aea83b9cb237.tar.zst mandoc-10c7195ae21b46c15b20ccb55be6aea83b9cb237.zip |
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.
-rw-r--r-- | roff.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.375 2020/08/03 11:02:57 schwarze Exp $ */ +/* $Id: roff.c,v 1.376 2020/08/27 12:59:02 schwarze Exp $ */ /* * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -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); |