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 c2e31d9a for ; Tue, 12 Sep 2017 13:21:33 -0500 (EST) Date: Tue, 12 Sep 2017 13:21:33 -0500 (EST) Message-Id: <501394399942668611.enqueue@fantadrom.bsd.lv> X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Do not segfault when there are two .Dt macros, the first without X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Do not segfault when there are two .Dt macros, the first without an architecture argument and the second with an invalid one. Bug found by jsg@ with afl(1). Modified Files: -------------- mandoc: mdoc_validate.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v retrieving revision 1.352 retrieving revision 1.353 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.352 -r1.353 --- mdoc_validate.c +++ mdoc_validate.c @@ -1914,7 +1914,10 @@ post_root(POST_ARGS) arch++; if (*arch == NULL) { n = mdoc->first->child; - while (n->tok != MDOC_Dt) + while (n->tok != MDOC_Dt || + n->child == NULL || + n->child->next == NULL || + n->child->next->next == NULL) n = n->next; n = n->child->next->next; mandoc_vmsg(MANDOCERR_ARCH_BAD, -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv