summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-10 12:29:03 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-10 12:29:03 +0000
commit57c1d81df9ef421d07ec3f01b1866d4d90da9818 (patch)
treeebcb2b7ee81b4f754c855f4d8e57c0a7eea19f3e
parent11d0baff1f437682cedb0262fb63f033fac1aebc (diff)
Don't printf("%s", NULL) if .It has a macro as an argument
in a list of a type where items don't takes arguments. Issue found by tb@ with afl(1).
-rw-r--r--usr.bin/mandoc/mdoc_validate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 68086efd59c..239b0d2b092 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.219 2016/08/10 12:04:57 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.220 2016/08/10 12:29:02 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -1055,10 +1055,11 @@ post_it(POST_ARGS)
mdoc_argnames[nbl->args->argv[0].arg]);
/* FALLTHROUGH */
case LIST_item:
- if (nit->head->child != NULL)
+ if ((nch = nit->head->child) != NULL)
mandoc_vmsg(MANDOCERR_ARG_SKIP,
mdoc->parse, nit->line, nit->pos,
- "It %s", nit->head->child->string);
+ "It %s", nch->string == NULL ?
+ mdoc_macronames[nch->tok] : nch->string);
break;
case LIST_column:
cols = (int)nbl->norm->Bl.ncols;