From 7b924e8a8456dcc91027409b05ad1daa42559c46 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 10 Aug 2016 12:29:38 +0000 Subject: 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). --- mdoc_validate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index e6fa51b2..214e98da 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.303 2016/08/10 12:06:41 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.304 2016/08/10 12:29:38 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -1064,10 +1064,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; -- cgit v1.2.3-56-ge451