diff options
-rw-r--r-- | mandoc.1 | 7 | ||||
-rw-r--r-- | mandoc.h | 1 | ||||
-rw-r--r-- | mdoc.c | 1 | ||||
-rw-r--r-- | mdoc_validate.c | 10 | ||||
-rw-r--r-- | read.c | 1 |
5 files changed, 20 insertions, 0 deletions
@@ -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 @@ -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 */ @@ -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); } @@ -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", |