Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Do not copy first keys into four key entries; the...



details:   https://anonhg.NetBSD.org/src/rev/12a0b8717410
branches:  trunk
changeset: 512831:12a0b8717410
user:      onoe <onoe%NetBSD.org@localhost>
date:      Wed Jul 18 02:06:44 2001 +0000

description:
Do not copy first keys into four key entries; the bug was introduced in 1.17

diffstat:

 sys/dev/ic/an.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (55 lines):

diff -r de251b5028df -r 12a0b8717410 sys/dev/ic/an.c
--- a/sys/dev/ic/an.c   Wed Jul 18 01:10:09 2001 +0000
+++ b/sys/dev/ic/an.c   Wed Jul 18 02:06:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: an.c,v 1.19 2001/07/07 15:53:17 thorpej Exp $  */
+/*     $NetBSD: an.c,v 1.20 2001/07/18 02:06:44 onoe Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999
  *     Bill Paul <wpaul%ctr.columbia.edu@localhost>.  All rights reserved.
@@ -653,24 +653,24 @@
 an_set_nwkey_wep(struct an_softc *sc, struct ieee80211_nwkey *nwkey)
 {
        int i, txkey, anysetkey, needreset, error;
-       struct an_wepkey keys[IEEE80211_WEP_NKID], *key;
+       struct an_wepkey keys[IEEE80211_WEP_NKID];
 
        error = 0;
        memset(keys, 0, sizeof(keys));
        anysetkey = needreset = 0;
 
        /* load argument and sanity check */
-       for (i = 0, key = keys; i < IEEE80211_WEP_NKID; i++, key++) {
-               key->an_wep_keylen = nwkey->i_key[i].i_keylen;
-               if (key->an_wep_keylen < 0)
+       for (i = 0; i < IEEE80211_WEP_NKID; i++) {
+               keys[i].an_wep_keylen = nwkey->i_key[i].i_keylen;
+               if (keys[i].an_wep_keylen < 0)
                        continue;
-               if (key->an_wep_keylen != 0 &&
-                   key->an_wep_keylen < IEEE80211_WEP_KEYLEN)
+               if (keys[i].an_wep_keylen != 0 &&
+                   keys[i].an_wep_keylen < IEEE80211_WEP_KEYLEN)
                        return EINVAL;
-               if (key->an_wep_keylen > sizeof(key->an_wep_key))
+               if (keys[i].an_wep_keylen > sizeof(keys[i].an_wep_key))
                        return EINVAL;
                if ((error = copyin(nwkey->i_key[i].i_keydat,
-                   key->an_wep_key, key->an_wep_keylen)) != 0)
+                   keys[i].an_wep_key, keys[i].an_wep_keylen)) != 0)
                        return error;
                anysetkey++;
        }
@@ -688,10 +688,10 @@
        if (!(nwkey->i_wepon & IEEE80211_NWKEY_PERSIST)) {
                /* set temporary keys */
                sc->an_tx_key = txkey;
-               for (i = 0, key = keys; i < IEEE80211_WEP_NKID; i++, key++) {
+               for (i = 0; i < IEEE80211_WEP_NKID; i++) {
                        if (keys[i].an_wep_keylen < 0)
                                continue;
-                       memcpy(&sc->an_wepkeys[i], keys, sizeof(*keys));
+                       memcpy(&sc->an_wepkeys[i], &keys[i], sizeof(keys[i]));
                }
        } else {
                /* set persist keys */



Home | Main Index | Thread Index | Old Index