diff options
author | 2012-02-05 18:51:18 +0000 | |
---|---|---|
committer | 2012-02-05 18:51:18 +0000 | |
commit | d9dd49c0282faaecd5dac2c83ba480b7ba02e48a (patch) | |
tree | 51b229acddb53a6020fb4fd8fab4059fd9f7574c /usr.bin/man/man.c | |
parent | Remove the extern declarations for the long-gone static msg queue (diff) | |
download | wireguard-openbsd-d9dd49c0282faaecd5dac2c83ba480b7ba02e48a.tar.xz wireguard-openbsd-d9dd49c0282faaecd5dac2c83ba480b7ba02e48a.zip |
Do not insert an empty ENTRY into the manpath list;
it's useless and causes out-of-bounds array access later.
While here, remove two unused local variables and two unused struct members.
From Tobias Ulmer <tobiasu at tmux dot org> on tech@, thanks.
"off to you" deraadt@
Diffstat (limited to 'usr.bin/man/man.c')
-rw-r--r-- | usr.bin/man/man.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index 56143bdda25..2499d056797 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.44 2012/01/05 21:46:15 schwarze Exp $ */ +/* $OpenBSD: man.c,v 1.45 2012/02/05 18:51:18 schwarze Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* @@ -95,7 +95,6 @@ main(int argc, char *argv[]) extern char *optarg; extern int optind; TAG *searchlist; - ENTRY *ep; glob_t pg; size_t len; int ch, f_cat, f_how, found; @@ -339,6 +338,10 @@ parse_path(TAG *t, char *path) char *p, *slashp; while ((p = strsep(&path, ":")) != NULL) { + /* Skip empty fields */ + if (*p == '\0') + continue; + if ((ep = malloc(sizeof(ENTRY))) == NULL) err(1, NULL); @@ -434,7 +437,7 @@ manual(char *page, TAG *tag, glob_t *pg) { ENTRY *ep, *e_sufp, *e_tag; TAG *missp, *sufp; - int anyfound, cnt, found, globres; + int anyfound, cnt, found; char *p, buf[MAXPATHLEN]; anyfound = 0; |