[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <171400306698.3284237.12157230203492551357.b4-ty@chromium.org>
Date: Wed, 24 Apr 2024 16:57:48 -0700
From: Kees Cook <keescook@...omium.org>
To: Tyler Hicks <code@...icks.com>,
Justin Stitt <justinstitt@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
ecryptfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] fs: ecryptfs: replace deprecated strncpy with strscpy
On Thu, 21 Mar 2024 00:38:54 +0000, 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. A good alternative is strscpy() as it guarantees
> NUL-termination on the destination buffer.
>
> In crypto.c:
> We expect cipher_name to be NUL-terminated based on its use with
> the C-string format specifier %s and with other string apis like
> strlen():
> | printk(KERN_ERR "Error attempting to initialize key TFM "
> | "cipher with name = [%s]; rc = [%d]\n",
> | tmp_tfm->cipher_name, rc);
> and
> | int cipher_name_len = strlen(cipher_name);
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] fs: ecryptfs: replace deprecated strncpy with strscpy
https://git.kernel.org/kees/c/9a2780409552
Take care,
--
Kees Cook
Powered by blists - more mailing lists