]> git.ipfire.org Git - thirdparty/openwrt.git/commit
mt76: replace strlcpy with strscpy 18927/head
authorMieczyslaw Nalewaj <namiltd@yahoo.com>
Tue, 27 May 2025 06:19:29 +0000 (08:19 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 19 Jun 2025 20:03:30 +0000 (22:03 +0200)
commit225622e0f9fb4cba6da747499a68f5ee34842573
tree1db199d68346bffd666237938dd23a8db949d37a
parent23faf4c485eff8d34941a6589dfbf5c233bd5727
mt76: replace strlcpy with strscpy

Change deprecated function strlcpy to strscpy
for compatibility with kernel 6.12.

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since DEV_ASSIGN is only used by
TRACE macros and the return values are ignored.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/18927
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/mt76/patches/002-wifi-mt76-replace-strlcpy-with-strscpy.patch [new file with mode: 0644]