[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <169221904769.1235632.10910494392812070923.b4-ty@chromium.org>
Date: Wed, 16 Aug 2023 13:50:50 -0700
From: Kees Cook <keescook@...omium.org>
To: Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
Justin Stitt <justinstitt@...gle.com>
Cc: Kees Cook <keescook@...omium.org>, linux-um@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] um: vector: refactor deprecated strncpy
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
Powered by blists - more mailing lists