Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH iw] iw: util: fix the EHT PHY capabilities buffer size
@ 2026-11-24 21:14 Josef Schlehofer
  0 siblings, 0 replies; only message in thread
From: Josef Schlehofer @ 2026-11-24 21:14 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Dylan Eskew

print_eht_info() stores the EHT PHY capabilities in an 8-byte
buffer, but the kernel provides 9 bytes. __print_eht_capa()
prints all 9 bytes and accesses two bits of the ninth byte
through phy_cap[2]. Both accesses go past the end of the
buffer, and the ninth byte is lost when copying the attribute.

Increase the buffer size to accommodate all 9 bytes.

Fixes: 4c859917316b ("iw: util: update and clean up eht capa printing")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
Checked with an AddressSanitizer build that feeds print_eht_info() a 9-byte
EHT PHY attribute. Without the fix it reports a stack-buffer-overflow in
__print_eht_capa(), with it the ninth byte and both of its bits are printed.

 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index 1bad4ea..1a35352 100644
--- a/util.c
+++ b/util.c
@@ -1769,7 +1769,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band)
 {
 	struct nlattr *tb[NL80211_BAND_IFTYPE_ATTR_MAX + 1];
 	__u8 mac_cap[2] = { 0 };
-	__u32 phy_cap[2] = { 0 };
+	__u32 phy_cap[3] = { 0 };
 	__u8 mcs_set[13] = { 0 };
 	__u8 ppet[31] = { 0 };
 	__u16 he_phy_cap[6] = { 0 };
-- 
2.54.0 (Apple Git-157)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 21:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 21:14 [PATCH iw] iw: util: fix the EHT PHY capabilities buffer size Josef Schlehofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox