summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-07-14 16:28:35 +0000
committerschwarze <schwarze@openbsd.org>2017-07-14 16:28:35 +0000
commit7cf3e35b56a39ee91de935ad30b1fc6ebb8790f6 (patch)
tree113ad3aa8d1f897202be798c2ab5e8f82a733aef /usr.bin/mandoc
parentReplace remaining "!var" expressions with (diff)
downloadwireguard-openbsd-7cf3e35b56a39ee91de935ad30b1fc6ebb8790f6.tar.xz
wireguard-openbsd-7cf3e35b56a39ee91de935ad30b1fc6ebb8790f6.zip
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...
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/html.c9
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 == '+') {