diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2022-06-06 12:09:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2022-06-06 12:09:19 +0000 |
commit | c64d154fe5814064a95c771dc474f100e6d5d316 (patch) | |
tree | e8aed909e4d734d750b31c0fc1eb5b56caf2e6a6 /usr.bin | |
parent | 9952fdd77f3dcd7c212a32683c4a728aa36322cb (diff) |
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 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/roff_escape.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/mandoc/roff_escape.c b/usr.bin/mandoc/roff_escape.c index 371ea6199af..fe2a910f4aa 100644 --- a/usr.bin/mandoc/roff_escape.c +++ b/usr.bin/mandoc/roff_escape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff_escape.c,v 1.10 2022/06/05 13:42:49 schwarze Exp $ */ +/* $OpenBSD: roff_escape.c,v 1.11 2022/06/06 12:09:18 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2020, 2022 * Ingo Schwarze <schwarze@openbsd.org> @@ -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 |