From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 1110ef23 for ; Wed, 10 Aug 2016 15:18:20 -0500 (EST) Date: Wed, 10 Aug 2016 15:18:20 -0500 (EST) Message-Id: <3145011355490204301.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Don't deref NULL if the only child of the first .Sh is an empty X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Don't deref NULL if the only child of the first .Sh is an empty in-line macro, and don't printf("%s", NULL) if the first child of the first .Sh is a macro; again found by tb@ with afl(1). (No, you should never use macros in any .Sh at all, please.) Modified Files: -------------- mdocml: mdoc_validate.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v retrieving revision 1.304 retrieving revision 1.305 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.304 -r1.305 --- mdoc_validate.c +++ mdoc_validate.c @@ -1761,8 +1761,9 @@ post_sh_authors(POST_ARGS) static void post_sh_head(POST_ARGS) { - const char *goodsec; - enum roff_sec sec; + struct roff_node *nch; + const char *goodsec; + enum roff_sec sec; /* * Process a new section. Sections are either "named" or @@ -1778,8 +1779,10 @@ post_sh_head(POST_ARGS) if (sec != SEC_NAME && mdoc->lastnamed == SEC_NONE) mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse, mdoc->last->line, mdoc->last->pos, "Sh %s", - sec == SEC_CUSTOM ? mdoc->last->child->string : - secnames[sec]); + sec != SEC_CUSTOM ? secnames[sec] : + (nch = mdoc->last->child) == NULL ? "" : + nch->type == ROFFT_TEXT ? nch->string : + mdoc_macronames[nch->tok]); /* The SYNOPSIS gets special attention in other areas. */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv