diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-02-06 19:41:35 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-02-06 19:41:35 +0000 |
commit | 37f4fd9c9ce5d1fa1475ca26ba874d18d132f5de (patch) | |
tree | 6796723f8de63d52e4ba50668bdf4b03fa6ddd22 /usr.bin/mandoc | |
parent | f9b92e0c7e89768c0240e830e271bf7ce5d6e8c7 (diff) |
Make sure that -l always causes -w to be ignored, as documented
in the man(1) manual page. This bugfix is needed to prevent
the command "man -lw" from dereferencing a NULL pointer.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/main.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 63ac156010b..bcf541409d1 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.244 2020/01/20 10:29:31 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.245 2020/02/06 19:41:34 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2012, 2014-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -309,7 +309,8 @@ main(int argc, char *argv[]) /* Postprocess options. */ - if (outmode == OUTMODE_DEF) { + switch (outmode) { + case OUTMODE_DEF: switch (search.argmode) { case ARG_FILE: outmode = OUTMODE_ALL; @@ -322,6 +323,16 @@ main(int argc, char *argv[]) outmode = OUTMODE_LST; break; } + break; + case OUTMODE_FLN: + if (search.argmode == ARG_FILE) + outmode = OUTMODE_ALL; + break; + case OUTMODE_ALL: + break; + case OUTMODE_LST: + case OUTMODE_ONE: + abort(); } if (oarg != NULL) { |