diff options
author | 2002-10-04 02:29:36 +0000 | |
---|---|---|
committer | 2002-10-04 02:29:36 +0000 | |
commit | 37764fa8d7105a4efef2788093f88fa241df1715 (patch) | |
tree | 5c4616a0a1c89ce10401e89493cef0fc83f42de4 | |
parent | powerpc support for stack trampoline mprotect. (diff) | |
download | wireguard-openbsd-37764fa8d7105a4efef2788093f88fa241df1715.tar.xz wireguard-openbsd-37764fa8d7105a4efef2788093f88fa241df1715.zip |
Limit the TX key to a valid range; imp@
-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]; }; /* |