Files
openwrt_mitrastar/package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch
Shiji Yang 2260afa381 rtl8812au-ct: fix build issue on 6.12 kernel
Update USB shutdown callback for the 6.12 kernel. A sprintf
overlaps issue is also fixed in this patch. Unfortunately,
there are dozens of missing-prototypes warnings so it's hard
to fix them one by one. Let's just silence them.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/18637
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-05-03 20:16:25 +02:00

29 lines
1.3 KiB
Diff

From: Shiji Yang <yangshiji66@outlook.com>
Date: Tue, 29 Apr 2025 00:21:50 +0800
Subject: [PATCH] fix sprintf() overlaps destination object warning
/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c: In function 'mp_query_psd':
/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c:1874:17: error: 'sprintf' argument 3 overlaps destination object 'data' [-Werror=restrict]
1874 | sprintf(data, "%s%x ", data, psd_data);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c:1839:41: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
1839 | u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
| ~~~~^~~~
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
core/rtw_mp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/core/rtw_mp.c
+++ b/core/rtw_mp.c
@@ -1871,7 +1871,7 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *
} else {
psd_data = rtw_GetPSDData(pAdapter, i);
}
- sprintf(data, "%s%x ", data, psd_data);
+ sprintf(data + strlen(data), "%x ", psd_data);
i++;
}