lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <5b4df38c-c16c-4571-96c3-4bf205543849@kernel.org> Date: Mon, 16 Oct 2023 07:59:22 +0200 From: Jiri Slaby <jirislaby@...nel.org> To: Justin Stitt <justinstitt@...gle.com>, Nick Kossifidis <mickflemm@...il.com>, Luis Chamberlain <mcgrof@...nel.org>, Kalle Valo <kvalo@...nel.org> Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org Subject: Re: [PATCH] ath5k: replace deprecated strncpy with strscpy On 13. 10. 23, 22:53, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect led->name to be NUL-terminated based on the presence of a > manual NUL-byte assignment. > > This NUL-byte assignment was added in Commit daf9669bea30aa22 ("ath5k: > ensure led name is null terminated"). If strscpy() had existed and had > been used back when this code was written then potential bugs and the > need to manually NUL-terminate could have been avoided. Since we now > have the technology, let's use it :) > > Considering the above, a suitable replacement is `strscpy` [2] due to > the fact that it guarantees NUL-termination on the destination buffer > without unnecessarily NUL-padding. If NUL-padding is required let's opt > for strscpy_pad(). > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@...r.kernel.org > Signed-off-by: Justin Stitt <justinstitt@...gle.com> LGTM Reviewed-by: Jiri Slaby <jirislaby@...nel.org> -- js suse labs
Powered by blists - more mailing lists