Changeset e71c023 in mainline


Ignore:
Timestamp:
2018-08-03T16:56:31Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
02246b8
Parents:
3767bdb
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-03 16:32:18)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-03 16:56:31)
Message:

Fix stack corruption in ieee80211 (courtesy of hosted mode diagnostics).

Location:
uspace/lib/ieee80211
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ieee80211/include/ieee80211_private.h

    r3767bdb re71c023  
    9898
    9999/** Special room in header reserved for encryption. */
    100 typedef enum {
    101         IEEE80211_TKIP_HEADER_LENGTH = 8,
    102         IEEE80211_CCMP_HEADER_LENGTH = 8
    103 } ieee80211_encrypt_header_reserve_length_t;
     100#define IEEE80211_TKIP_HEADER_LENGTH 8
     101#define IEEE80211_CCMP_HEADER_LENGTH 8
    104102
    105103/** IEEE 802.11 PTK key length. */
    106 typedef enum {
    107         IEEE80211_PTK_CCMP_LENGTH = 48,
    108         IEEE80211_PTK_TKIP_LENGTH = 64
    109 } ieee80211_ptk_length_t;
     104#define IEEE80211_PTK_CCMP_LENGTH 48
     105#define IEEE80211_PTK_TKIP_LENGTH 64
    110106
    111107/** IEEE 802.11 GTK key length. */
    112 typedef enum {
    113         IEEE80211_GTK_CCMP_LENGTH = 16,
    114         IEEE80211_GTK_TKIP_LENGTH = 32
    115 } ieee80211_gtk_length_t;
     108#define IEEE80211_GTK_CCMP_LENGTH 16
     109#define IEEE80211_GTK_TKIP_LENGTH 32
    116110
    117111/** IEEE 802.11 frame types. */
  • uspace/lib/ieee80211/src/ieee80211.c

    r3767bdb re71c023  
    571571        /* Init crypto data. */
    572572        bool add_mic = false;
     573        const size_t max_head_space = max(IEEE80211_TKIP_HEADER_LENGTH,
     574            IEEE80211_CCMP_HEADER_LENGTH);
    573575        size_t head_space = 0, mic_space = 0;
    574576        uint16_t crypto = 0;
    575         uint8_t head_data[head_space];
    576         memset(head_data, 0, head_space);
     577        uint8_t head_data[max_head_space];
     578        memset(head_data, 0, max_head_space);
    577579
    578580        // TODO: Distinguish used key (pair/group) by dest address ?
Note: See TracChangeset for help on using the changeset viewer.