diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-30 19:04:16 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-30 19:04:16 +0000 |
commit | fc07bd4ebdd99fc6e88a9e48d44eae67c93f0b24 (patch) | |
tree | f2c792a331013989c5a5314c9567b9ca77876366 | |
parent | 86f7c723953672d317bade10fa45e919e6bec8ff (diff) | |
download | mandoc-fc07bd4ebdd99fc6e88a9e48d44eae67c93f0b24.tar.gz mandoc-fc07bd4ebdd99fc6e88a9e48d44eae67c93f0b24.tar.zst mandoc-fc07bd4ebdd99fc6e88a9e48d44eae67c93f0b24.zip |
If a .Bd block has no arguments at all, drop the block and only keep
its contents. Removing a gratuitious difference to groff output
found after a related bug report from krw@.
-rw-r--r-- | mandoc.1 | 11 | ||||
-rw-r--r-- | mandoc.h | 3 | ||||
-rw-r--r-- | mdoc.c | 3 | ||||
-rw-r--r-- | mdoc_validate.c | 12 | ||||
-rw-r--r-- | read.c | 3 |
5 files changed, 26 insertions, 6 deletions
@@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.162 2015/10/06 15:33:29 schwarze Exp $ +.\" $Id: mandoc.1,v 1.163 2015/10/30 19:04:16 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 6 2015 $ +.Dd $Mdocdate: October 30 2015 $ .Dt MANDOC 1 .Os .Sh NAME @@ -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 @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.206 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.207 2015/10/30 19:04:16 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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 */ @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.255 2015/10/20 02:01:31 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.256 2015/10/30 19:04:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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 d1aa7e10..9261e2fb 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.299 2015/10/21 23:51:11 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.300 2015/10/30 19:04:16 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.144 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: read.c,v 1.145 2015/10/30 19:04:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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", |