diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-07-14 16:28:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-07-14 16:28:36 +0000 |
commit | 88da0b206b0e81239c2358d171b0dd1a601d8789 (patch) | |
tree | 3c4ca249cfbd718b97a4aa0cdbb164063daba6c8 | |
parent | d8acf8cda47408f2d8b06a198e0b1713ba5b2a86 (diff) |
Fix an assertion failure triggered by print_otag("sw+-l", NULL).
Even though we skip the style when the argument is NULL,
we must still consume the options.
Not found with afl(1), but during manual testing of the previous patch...
-rw-r--r-- | usr.bin/mandoc/html.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 74f57b915ee..61f0470e49c 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.87 2017/07/14 16:05:52 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.88 2017/07/14 16:28:35 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -622,8 +622,13 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) su = va_arg(ap, struct roffsu *); break; case 'w': - if ((arg2 = va_arg(ap, char *)) == NULL) + if ((arg2 = va_arg(ap, char *)) == NULL) { + if (*fmt == '+') + fmt++; + if (*fmt == '-') + fmt++; break; + } su = &mysu; a2width(arg2, su); if (*fmt == '+') { |