summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>1999-06-07 07:20:38 +0000
committerangelos <angelos@openbsd.org>1999-06-07 07:20:38 +0000
commite6c5226eb27a64da33ef78c72f9c1aa6af57a124 (patch)
tree14bcc7c30772299ae99d69302c9adba8fd545020
parentsync (diff)
downloadwireguard-openbsd-e6c5226eb27a64da33ef78c72f9c1aa6af57a124.tar.xz
wireguard-openbsd-e6c5226eb27a64da33ef78c72f9c1aa6af57a124.zip
Fix use of uninitialized TDB hash table in tdb_delete(), introduced
along with the dynamically-resized TDB table (report and fix suggestion by henric@ncal.verio.com)
-rw-r--r--sys/netinet/ip_ipsp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 0fbfdc0c04d..17aee8d995a 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.45 1999/06/04 22:40:36 provos Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.46 1999/06/07 07:20:38 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -146,7 +146,7 @@ struct xformsw *xformswNXFORMSW = &xformsw[sizeof(xformsw)/sizeof(xformsw[0])];
unsigned char ipseczeroes[IPSEC_ZEROES_SIZE]; /* zeroes! */
#define TDB_HASHSIZE_INIT 32
-static struct tdb **tdbh;
+static struct tdb **tdbh = NULL;
static u_int tdb_hashmask = TDB_HASHSIZE_INIT - 1;
/*
@@ -840,6 +840,9 @@ tdb_delete(struct tdb *tdbp, int delchain, int expflags)
u_int32_t hashval = tdbp->tdb_sproto + tdbp->tdb_spi, i;
int s;
+ if (tdbh == NULL)
+ return;
+
for (i = 0; i < SA_LEN(&tdbp->tdb_dst.sa); i++)
hashval += ptr[i];