]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Simplify Timeout Interval element parsing
authorJouni Malinen <j@w1.fi>
Sun, 19 Apr 2015 13:38:11 +0000 (16:38 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 22 Apr 2015 19:05:11 +0000 (22:05 +0300)
Remove the length field from struct ieee802_11_elems since the only
allowed element length is five and that is checked by the parser.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
wlantest/rx_mgmt.c
wlantest/rx_tdls.c

index 69ffa8f4cf9718af6877f31ff8a9064d83852fb4..7b4ee18381a0ee9b5d48de7170c9f0f75abd7957 100644 (file)
@@ -263,7 +263,6 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
                        if (elen != 5)
                                break;
                        elems->timeout_int = pos;
-                       elems->timeout_int_len = elen;
                        break;
                case WLAN_EID_HT_CAP:
                        elems->ht_capabilities = pos;
index ae99f7f5dc493e179b16e12e35019b83aa7d092d..a689e6bba09d6b93b7d004b451df683be3d949ca 100644 (file)
@@ -61,7 +61,6 @@ struct ieee802_11_elems {
        u8 supp_channels_len;
        u8 mdie_len;
        u8 ftie_len;
-       u8 timeout_int_len;
        u8 ht_capabilities_len;
        u8 ht_operation_len;
        u8 mesh_config_len;
index 459b9a69f61a875799b4fbb17be0d62ac4733735..45433dd4e3e5430482ea48da7dd69043b23b7ba2 100644 (file)
@@ -348,7 +348,6 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len)
                                 "AssocResp from " MACSTR,
                                 MAC2STR(mgmt->sa));
                } else if (elems.timeout_int == NULL ||
-                          elems.timeout_int_len != 5 ||
                           elems.timeout_int[0] !=
                           WLAN_TIMEOUT_ASSOC_COMEBACK) {
                        add_note(wt, MSG_INFO, "No valid Timeout Interval IE "
@@ -481,7 +480,6 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
                                 "ReassocResp from " MACSTR,
                                 MAC2STR(mgmt->sa));
                } else if (elems.timeout_int == NULL ||
-                          elems.timeout_int_len != 5 ||
                           elems.timeout_int[0] !=
                           WLAN_TIMEOUT_ASSOC_COMEBACK) {
                        add_note(wt, MSG_INFO, "No valid Timeout Interval IE "
index f059e8dd8de200509aaebadb74fb8c9413e566cc..0c012a931822cfb906196a5f54460f65769becc1 100644 (file)
@@ -147,7 +147,7 @@ static int tdls_verify_mic(struct wlantest *wt, struct wlantest_tdls *tdls,
                return -1;
 
        len = 2 * ETH_ALEN + 1 + 2 + 18 + 2 + elems->rsn_ie_len +
-               2 + elems->timeout_int_len + 2 + elems->ftie_len;
+               2 + 5 + 2 + elems->ftie_len;
 
        buf = os_zalloc(len);
        if (buf == NULL)
@@ -169,8 +169,8 @@ static int tdls_verify_mic(struct wlantest *wt, struct wlantest_tdls *tdls,
        os_memcpy(pos, elems->rsn_ie - 2, 2 + elems->rsn_ie_len);
        pos += 2 + elems->rsn_ie_len;
        /* 6) Timeout Interval IE */
-       os_memcpy(pos, elems->timeout_int - 2, 2 + elems->timeout_int_len);
-       pos += 2 + elems->timeout_int_len;
+       os_memcpy(pos, elems->timeout_int - 2, 2 + 5);
+       pos += 2 + 5;
        /* 7) FTIE, with the MIC field of the FTIE set to 0 */
        os_memcpy(pos, elems->ftie - 2, 2 + elems->ftie_len);
        pos += 2;