summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-06-17 23:25:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-06-17 23:25:55 +0000
commite15e1120aa721c07312a420969b757d800b57ddc (patch)
treec2f8b001619b88e0447c0218d9d0edbf762ec1f8
parente99ae7194fa315459796e366ab57a9dc324f0d1a (diff)
check em_if and em_ifn better; thanks adam@math.tau.ac.il
-rw-r--r--sys/net/encap.c18
-rw-r--r--sys/net/encap.h4
2 files changed, 9 insertions, 13 deletions
diff --git a/sys/net/encap.c b/sys/net/encap.c
index 1930cb2287a..acd9a4e179c 100644
--- a/sys/net/encap.c
+++ b/sys/net/encap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encap.c,v 1.3 1997/04/25 01:19:20 angelos Exp $ */
+/* $OpenBSD: encap.c,v 1.4 1997/06/17 23:25:53 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -172,6 +172,8 @@ encap_output(m, va_alist)
switch (emp->em_type)
{
case EMT_IFADDR:
+ if (emp->em_ifn >= nencap)
+ SENDERR(ENODEV);
/*
* Set the default source address for an encap interface
*/
@@ -213,8 +215,7 @@ encap_output(m, va_alist)
case EMT_SETSPI:
if (emp->em_if >= nencap)
- SENDERR(ENODEV);
-
+ SENDERR(ENODEV);
tdbp = gettdb(emp->em_spi, emp->em_dst);
if (tdbp == NULL)
{
@@ -238,8 +239,7 @@ encap_output(m, va_alist)
case EMT_DELSPI:
if (emp->em_if >= nencap)
- SENDERR(ENODEV);
-
+ SENDERR(ENODEV);
tdbp = gettdb(emp->em_spi, emp->em_dst);
if (tdbp == NULL)
{
@@ -257,9 +257,8 @@ encap_output(m, va_alist)
break;
case EMT_DELSPICHAIN:
- if (emp->em_if >= nencap)
- SENDERR(ENODEV);
-
+ if (emp->em_if >= nencap)
+ SENDERR(ENODEV);
tdbp = gettdb(emp->em_spi, emp->em_dst);
if (tdbp == NULL)
{
@@ -279,10 +278,7 @@ encap_output(m, va_alist)
case EMT_GRPSPIS:
nspis = (emlen - 4) / 12;
if (nspis * 12 + 4 != emlen)
- {
SENDERR(EINVAL);
- break;
- }
for (i = 0; i < nspis; i++)
if ((tdbp = gettdb(emp->em_rel[i].emr_spi, emp->em_rel[i].emr_dst)) == NULL)
diff --git a/sys/net/encap.h b/sys/net/encap.h
index 98a61491abb..328d29eabe7 100644
--- a/sys/net/encap.h
+++ b/sys/net/encap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: encap.h,v 1.2 1997/02/24 13:33:56 niklas Exp $ */
+/* $OpenBSD: encap.h,v 1.3 1997/06/17 23:25:54 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -186,7 +186,7 @@ struct encap_msghdr
{
u_int32_t Spi; /* SPI */
struct in_addr Dst; /* Destination address */
- int32_t If; /* enc i/f for input */
+ u_int32_t If; /* enc i/f for input */
int32_t Alg; /* Algorithm to use */
u_int8_t Dat[1]; /* Data */
} Xfm;