aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-14 16:28:38 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-14 16:28:38 +0000
commit251fb22aeecbbce2c8608e951b9042881f98244e (patch)
treec5cfe1741c12316451f5dcb098e507d8b796a73c
parent9ab0f1d2fbd0ca6762382443886903e11810663b (diff)
downloadmandoc-251fb22aeecbbce2c8608e951b9042881f98244e.tar.gz
mandoc-251fb22aeecbbce2c8608e951b9042881f98244e.tar.zst
mandoc-251fb22aeecbbce2c8608e951b9042881f98244e.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...
-rw-r--r--html.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/html.c b/html.c
index c6442783..28f8cf98 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.217 2017/07/14 16:06:44 schwarze Exp $ */
+/* $Id: html.c,v 1.218 2017/07/14 16:28:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -624,8 +624,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 == '+') {