source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Do not segfault in makewhatis -Q if the next .SH after .SH NAME
@ 2014-05-07 14:14 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-05-07 14:14 UTC (permalink / raw)
  To: source

Log Message:
-----------
Do not segfault in makewhatis -Q if the next .SH after .SH NAME
does not have any arguments.  Crash found by nigel@ in kermit(1).

Modified Files:
--------------
    mdocml:
        man.c

Revision Data
-------------
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -Lman.c -Lman.c -u -p -r1.129 -r1.130
--- man.c
+++ man.c
@@ -595,9 +595,12 @@ man_pmacro(struct man *man, int ln, char
 
 	/* In quick mode (for mandocdb), abort after the NAME section. */
 
-	if (man->quick && MAN_SH == tok &&
-	    strcmp(man->last->prev->child->string, "NAME"))
-		return(2);
+	if (man->quick && MAN_SH == tok) {
+		n = man->last;
+		if (MAN_BODY == n->type &&
+		    strcmp(n->prev->child->string, "NAME"))
+			return(2);
+	}
 
 	/*
 	 * We weren't in a block-line scope when entering the
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-07 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 14:14 mdocml: Do not segfault in makewhatis -Q if the next .SH after .SH NAME 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).