lkml.org 
[lkml]   [2023]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] um: vector: refactor deprecated strncpy
Date
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

\
 
 \ /
  Last update: 2023-08-16 22:52    [W:0.027 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site