diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-05-07 14:14:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-05-07 14:14:17 +0000 |
commit | b9c525e48989511fbf504fe170eb6ba6231845fb (patch) | |
tree | c6ca7bf26cc738b6fb761d3a0a154353c7d04cde /man.c | |
parent | 1a3508134c2d35578a77bd0e53a064ada6d757a5 (diff) | |
download | mandoc-b9c525e48989511fbf504fe170eb6ba6231845fb.tar.gz |
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).
Diffstat (limited to 'man.c')
-rw-r--r-- | man.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -595,9 +595,12 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) /* 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 |