From e310bf51da8b2ca77c201bd10221ea46d4060043 Mon Sep 17 00:00:00 2001 From: Igor Velkov <325961+iav@users.noreply.github.com> Date: Sun, 16 Aug 2026 17:33:35 +0300 Subject: [PATCH] Use C99 flexible array members for the trailing variable-length arrays ieee80211.h (wpa_ie.data, crypt.key, bcn_ie.buf, ieee_param_ex.data, info_element.data) and wlan_bssdef.h (NDIS_802_11_VARIABLE_IEs.data) declared their trailing payloads as [0] / [1]. Since 6.5 the kernel builds with -fstrict-flex-arrays=3, so only [] is treated as a flexible array and every index into these members is reported as out of bounds (clang -Warray-bounds, 22). None of the affected types is used with sizeof(), so no size changes. --- include/ieee80211.h | 10 +++++----- include/wlan_bssdef.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ieee80211.h b/include/ieee80211.h index 5c45b57..740a1c7 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -333,7 +333,7 @@ typedef struct ieee_param { struct { u32 len; u8 reserved[32]; - u8 data[0]; + u8 data[]; } wpa_ie; struct { int command; @@ -346,7 +346,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 { @@ -358,7 +358,7 @@ typedef struct ieee_param { } add_sta; struct { u8 reserved[2];/* for set max_num_sta */ - u8 buf[0]; + u8 buf[]; } bcn_ie; #endif @@ -369,7 +369,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 { @@ -1258,7 +1258,7 @@ struct ieee80211_info_element_hdr { struct ieee80211_info_element { u8 id; u8 len; - u8 data[0]; + u8 data[]; } __attribute__((packed)); #endif 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 {