From 76aa342b7367e5d900f0a02c69f30ba33c50326f Mon Sep 17 00:00:00 2001 From: Shobek Attupurath Date: Fri, 18 Oct 2024 17:59:14 +0000 Subject: [PATCH] rtk_btusb: Fix potential buffer overflow in cfg_list_item struct The `cfg_list_item` struct previously defined the `data` array with a zero-length, which can lead to buffer overflow issues detected by the `fortify_memcpy_chk` function. So change the zero-length array to a flexible array length. Bug 4915378 Change-Id: I3420406e73a9eec892665380bb15d680df12e751 Signed-off-by: Shobek Attupurath Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3237079 (cherry picked from commit 9c30467627d411bfcb69a0962941713aa85d9d9a) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233101 GVS: buildbot_gerritrpt Reviewed-by: Ashutosh Jha --- drivers/bluetooth/realtek/rtk_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/realtek/rtk_misc.c b/drivers/bluetooth/realtek/rtk_misc.c index eed8d0a9..00e34763 100644 --- a/drivers/bluetooth/realtek/rtk_misc.c +++ b/drivers/bluetooth/realtek/rtk_misc.c @@ -69,7 +69,7 @@ struct cfg_list_item { struct list_head list; u16 offset; u8 len; - u8 data[0]; + u8 data[]; }; static struct list_head list_configs;