Re: [PATCH] ath6kl: replace deprecated strncpy with memcpy

From: Kalle Valo
Date: Wed Oct 18 2023 - 04:33:00 EST


Justin Stitt <justinstitt@xxxxxxxxxx> wrote:

> strncpy() is deprecated for use on NUL-terminated destination strings
> [1] and as such we should prefer more robust and less ambiguous
> interfaces.
>
> The affected code's purpose is to truncate strings that are too long
> with "..." like:
> foobar -> fo...
>
> The lengths have been carefully calculated and as such this has decayed
> to a simple byte copy from one buffer to another -- let's use memcpy().
>
> Note: build-tested only.
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening@xxxxxxxxxxxxxxx
> Signed-off-by: Justin Stitt <justinstitt@xxxxxxxxxx>
> Signed-off-by: Kalle Valo <quic_kvalo@xxxxxxxxxxx>

Patch applied to ath-next branch of ath.git, thanks.

40990961d983 wifi: ath6kl: replace deprecated strncpy with memcpy

--
https://patchwork.kernel.org/project/linux-wireless/patch/20231013-strncpy-drivers-net-wireless-ath-ath6kl-init-c-v1-1-d69c599b49a9@xxxxxxxxxx/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches