diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-04 02:29:37 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-04 02:29:37 +0000 |
commit | 9905626eb2b1f838216c6a7319a30c3aaed6487c (patch) | |
tree | 6f7cb866eeaeb4ba763d246f230241a4cbeb8dfb /sys/dev | |
parent | a201576156a73f62d7bf8ffb19119b643fe4719a (diff) |
Limit the TX key to a valid range; imp@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/if_wi.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/if_wi_ieee.h | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 72e6c99bedb..9ed7ee1d4ef 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.79 2002/08/30 08:19:49 fgsch Exp $ */ +/* $OpenBSD: if_wi.c,v 1.80 2002/10/04 02:29:36 millert Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -124,7 +124,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.79 2002/08/30 08:19:49 fgsch Exp $"; + "$OpenBSD: if_wi.c,v 1.80 2002/10/04 02:29:36 millert Exp $"; #endif /* lint */ #ifdef foo @@ -933,6 +933,8 @@ wi_read_record(sc, ltv) ltv = &p2ltv; break; case WI_RID_TX_CRYPT_KEY: + if (ltv->wi_val > WI_NLTV_KEYS) + return (EINVAL); p2ltv.wi_type = WI_RID_P2_TX_CRYPT_KEY; p2ltv.wi_len = 2; ltv = &p2ltv; @@ -1077,6 +1079,8 @@ wi_write_record(sc, ltv) ltv = &p2ltv; break; case WI_RID_TX_CRYPT_KEY: + if (ltv->wi_val > WI_NLTV_KEYS) + return (EINVAL); p2ltv.wi_type = WI_RID_P2_TX_CRYPT_KEY; p2ltv.wi_len = 2; p2ltv.wi_val = ltv->wi_val; diff --git a/sys/dev/ic/if_wi_ieee.h b/sys/dev/ic/if_wi_ieee.h index cff437f7ac9..4301b8921a9 100644 --- a/sys/dev/ic/if_wi_ieee.h +++ b/sys/dev/ic/if_wi_ieee.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_ieee.h,v 1.11 2002/09/10 08:21:35 fgsch Exp $ */ +/* $OpenBSD: if_wi_ieee.h,v 1.12 2002/10/04 02:29:36 millert Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -273,10 +273,11 @@ struct wi_key { u_int8_t wi_keydat[14]; }; +#define WI_NLTV_KEYS 4 struct wi_ltv_keys { u_int16_t wi_len; u_int16_t wi_type; - struct wi_key wi_keys[4]; + struct wi_key wi_keys[WI_NLTV_KEYS]; }; /* |