summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2023-10-22 16:02:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2023-10-22 16:02:01 +0000
commit9e6e090ca7544bf35064fd24b38a45248c31af7b (patch)
treebeb1a0c90c86bb23a154efeb60fe4c4168edab90 /roff.c
parentc198ddab2341ad8774cb270f30a515788ff66ecb (diff)
downloadmandoc-9e6e090ca7544bf35064fd24b38a45248c31af7b.tar.gz
While doing delayed expansion of escape sequences in macro arguments,
correctly check for failure of the in-place expansion function. If an argument not only does recursive delayed expansion but infinitely recursive delayed expansion, this bug could result in an ESCAPE_EXPAND assertion failure. Thanks to Eric van Gyzen <vangyzen at FreeBSD> for finding this bug by inspecting FreeBSD source code.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index 3c1a3089..0005b999 100644
--- a/roff.c
+++ b/roff.c
@@ -1689,7 +1689,7 @@ roff_getarg(struct roff *r, char **cpp, int ln, int *pos)
buf.buf = start;
buf.sz = strlen(start) + 1;
buf.next = NULL;
- if (roff_expand(r, &buf, ln, 0, '\\') & ROFF_IGN) {
+ if (roff_expand(r, &buf, ln, 0, '\\') == ROFF_IGN) {
free(buf.buf);
buf.buf = mandoc_strdup("");
}