summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.17
-rw-r--r--mandoc.h1
-rw-r--r--mdoc.c1
-rw-r--r--mdoc_validate.c10
-rw-r--r--read.c1
5 files changed, 20 insertions, 0 deletions
diff --git a/mandoc.1 b/mandoc.1
index 510f5ab5..263c4e1d 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1600,6 +1600,13 @@ By requesting the inclusion of a sensitive file, a malicious document
might otherwise trick a privileged user into inadvertently displaying
the file on the screen, revealing the file content to bystanders.
The argument is ignored including the file name following it.
+.It Sy "skipping display without arguments"
+.Pq mdoc
+A
+.Ic \&Bd
+block macro does not have any arguments.
+The block is discarded, and the block content is displayed in
+whatever mode was active before the block.
.It Sy "missing list type, using -item"
.Pq mdoc
A
diff --git a/mandoc.h b/mandoc.h
index 63e68707..cfa88345 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -172,6 +172,7 @@ enum mandocerr {
/* related to request and macro arguments */
MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */
MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */
+ MANDOCERR_BD_NOARG, /* skipping display without arguments: Bd */
MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */
MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */
MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */
diff --git a/mdoc.c b/mdoc.c
index 28f94d0b..dca556e0 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -205,6 +205,7 @@ mdoc_node_relink(struct roff_man *mdoc, struct roff_node *p)
{
roff_node_unlink(mdoc, p);
+ p->prev = p->next = NULL;
roff_node_append(mdoc, p);
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 37b3a0f3..5a3a347e 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -895,6 +895,16 @@ post_display(POST_ARGS)
break;
case ROFFT_BLOCK:
if (n->tok == MDOC_Bd) {
+ if (n->args == NULL) {
+ mandoc_msg(MANDOCERR_BD_NOARG,
+ mdoc->parse, n->line, n->pos, "Bd");
+ mdoc->next = ROFF_NEXT_SIBLING;
+ while (n->body->child != NULL)
+ mdoc_node_relink(mdoc,
+ n->body->child);
+ roff_node_delete(mdoc, n);
+ break;
+ }
post_bd(mdoc);
post_prevpar(mdoc);
}
diff --git a/read.c b/read.c
index 980e0e43..6ed4fb29 100644
--- a/read.c
+++ b/read.c
@@ -215,6 +215,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
/* related to request and macro arguments */
"escaped character not allowed in a name",
"NOT IMPLEMENTED: Bd -file",
+ "skipping display without arguments",
"missing list type, using -item",
"missing manual name, using \"\"",
"uname(3) system call failed, using UNKNOWN",