From 01cc26136310c09c4b2249f83271dc14c41fd8f3 Mon Sep 17 00:00:00 2001 From: morrownr Date: Mon, 18 Mar 2024 14:44:05 -0500 Subject: [PATCH] fix UBSAN: array-index-out-of-bounds --- include/ieee80211.h | 12 ++++++------ include/wlan_bssdef.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ieee80211.h b/include/ieee80211.h index 62d0f66..9687bfc 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -335,7 +335,7 @@ typedef struct ieee_param { struct { u32 len; u8 reserved[32]; - u8 data[0]; + u8 data[]; } wpa_ie; struct { int command; @@ -348,7 +348,7 @@ typedef struct ieee_param { u8 idx; u8 seq[8]; /* sequence counter (set: RX, get: TX) */ u16 key_len; - u8 key[0]; + u8 key[]; } crypt; #ifdef CONFIG_AP_MODE struct { @@ -360,7 +360,7 @@ typedef struct ieee_param { } add_sta; struct { u8 reserved[2];/* for set max_num_sta */ - u8 buf[0]; + u8 buf[]; } bcn_ie; #endif @@ -371,7 +371,7 @@ typedef struct ieee_param { typedef struct ieee_param_ex { u32 cmd; u8 sta_addr[ETH_ALEN]; - u8 data[0]; + u8 data[]; } ieee_param_ex; struct sta_data { @@ -1177,7 +1177,7 @@ struct ieee80211_info_element_hdr { struct ieee80211_info_element { u8 id; u8 len; - u8 data[0]; + u8 data[]; } __attribute__((packed)); #endif @@ -1249,7 +1249,7 @@ struct ieee80211_txb { u16 reserved; u16 frag_size; u16 payload_size; - struct sk_buff *fragments[0]; + struct sk_buff *fragments[]; }; diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index c8f3229..160c949 100644 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -65,7 +65,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { u8 ElementID; u8 Length; - u8 data[1]; + u8 data[]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; typedef enum _NDIS_802_11_AUTHENTICATION_MODE { @@ -150,7 +150,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { u8 ElementID; u8 Length; - u8 data[1]; + u8 data[]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; typedef enum _NDIS_802_11_AUTHENTICATION_MODE {