Messages in this thread | | | From | Kees Cook <> | Subject | Re: [PATCH] um: vector: refactor deprecated strncpy | Date | Wed, 16 Aug 2023 13:50:50 -0700 |
| |
On Mon, 07 Aug 2023 18:22:30 +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the fact that it > guarantees NUL-termination on its destination buffer argument which is > _not_ the case for `strncpy`! > > In this case, we are able to drop the now superfluous `... - 1` > instances because `strscpy` will automatically truncate the last byte by > setting it to a NUL byte if the source size exceeds the destination size > or if the source string is not NUL-terminated. > > [...]
Applied to for-next/hardening, thanks!
[1/1] um: vector: refactor deprecated strncpy https://git.kernel.org/kees/c/30bed99e0c63
Take care,
-- Kees Cook
| |