diff options
author | 2012-02-05 18:51:18 +0000 | |
---|---|---|
committer | 2012-02-05 18:51:18 +0000 | |
commit | d9dd49c0282faaecd5dac2c83ba480b7ba02e48a (patch) | |
tree | 51b229acddb53a6020fb4fd8fab4059fd9f7574c | |
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@
-rw-r--r-- | usr.bin/man/config.h | 4 | ||||
-rw-r--r-- | usr.bin/man/man.c | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/man/config.h b/usr.bin/man/config.h index dc53172667d..96262c8939a 100644 --- a/usr.bin/man/config.h +++ b/usr.bin/man/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.5 2004/09/15 22:20:03 deraadt Exp $ */ +/* $OpenBSD: config.h,v 1.6 2012/02/05 18:51:18 schwarze Exp $ */ /* $NetBSD: config.h,v 1.2 1995/09/28 06:05:28 tls Exp $ */ /*- @@ -38,13 +38,11 @@ typedef struct _tag { TAILQ_HEAD(tqh, _entry) list; /* Queue of entries. */ char *s; /* Associated string. */ - size_t len; /* Length of 's'. */ } TAG; typedef struct _entry { TAILQ_ENTRY(_entry) q; /* Queue of entries. */ char *s; /* Associated string. */ - size_t len; /* Length of 's'. */ } ENTRY; TAILQ_HEAD(_head, _tag); 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; |