aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff_escape.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-06-06 12:09:48 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-06-06 12:09:48 +0000
commitba56b67d4eddedb1f10c98b2cdc7e0c798c1799a (patch)
treed282b7f49ae3c1e648fbe26fd3860132b865765f /roff_escape.c
parent2eb74bb175e1e2d190025028589fd47a3c0674ca (diff)
downloadmandoc-ba56b67d4eddedb1f10c98b2cdc7e0c798c1799a.tar.gz
mandoc-ba56b67d4eddedb1f10c98b2cdc7e0c798c1799a.tar.zst
mandoc-ba56b67d4eddedb1f10c98b2cdc7e0c798c1799a.zip
Allow arbitrary argument delimiters for \C, like groff does.
The restriction of only allowing ' as the delimiter was introduced by kristaps@ on 2011/04/09 when he first supported \C. For most other escape sequences, similar restrictions were relaxed later on, but for the rarely used \C, it was apparently forgotten. While here, reject empty character names: they are never valid.
Diffstat (limited to 'roff_escape.c')
-rw-r--r--roff_escape.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/roff_escape.c b/roff_escape.c
index 777d753b..39d57e88 100644
--- a/roff_escape.c
+++ b/roff_escape.c
@@ -206,10 +206,6 @@ roff_escape(const char *buf, const int ln, const int aesc,
term = '\b';
break;
case 'C':
- if (buf[iarg] != '\'') {
- rval = ESCAPE_ERROR;
- goto out;
- }
rval = ESCAPE_SPECIAL;
term = '\b';
break;
@@ -391,6 +387,11 @@ roff_escape(const char *buf, const int ln, const int aesc,
break;
case ESCAPE_SPECIAL:
+ if (argl == 0) {
+ err = MANDOCERR_ESC_BADCHAR;
+ rval = ESCAPE_ERROR;
+ break;
+ }
/*
* The file chars.c only provides one common list of