--- src/man.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- src/man.c +++ src/man.c 2016-12-15 13:49:52.184819971 +0000 @@ -961,7 +961,7 @@ static const char *is_section (const cha { const char **vs; - for (vs = section_list; *vs; vs++) { + for (vs = section_list; vs && *vs; vs++) { if (STREQ (*vs, name)) return name; /* allow e.g. 3perl but disallow 8139too and libfoo */ @@ -2714,7 +2714,7 @@ static int compare_candidates (const str /* Find out whether lsource->ext is ahead of rsource->ext in * section_list. */ - for (sp = section_list; *sp; ++sp) { + for (sp = section_list; sp && *sp; ++sp) { if (!*(*sp + 1)) { /* No extension */ if (!sec_left && **sp == *(lsource->ext)) @@ -3679,7 +3679,7 @@ static int do_global_apropos (const char } else my_section_list = section_list; - for (sp = my_section_list; *sp; sp++) + for (sp = my_section_list; sp && *sp; sp++) for (mp = manpathlist; *mp; mp++) *found += do_global_apropos_section (*mp, *sp, name); @@ -3879,7 +3879,7 @@ static int man (const char *name, int *f else { const char **sp; - for (sp = section_list; *sp; sp++) { + for (sp = section_list; sp && *sp; sp++) { locate_page_in_manpath (*sp, name, &candidates, found); } }