* mandoc: Do not segfault when there are two .Dt macros, the first without
@ 2017-09-12 18:21 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-09-12 18:21 UTC (permalink / raw)
To: source
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-12 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 18:21 mandoc: Do not segfault when there are two .Dt macros, the first without schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).