[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <171166321787.3580825.614329784153739643.b4-ty@chromium.org>
Date: Thu, 28 Mar 2024 15:00:19 -0700
From: Kees Cook <keescook@...omium.org>
To: Tony Luck <tony.luck@...el.com>,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>,
Justin Stitt <justinstitt@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pstore/blk: replace deprecated strncpy with strscpy
On Thu, 28 Mar 2024 20:54:16 +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.
>
> We know that info-device should be NUL-terminated based on its use with
> strlen():
> | static int __init mtdpstore_init(void)
> | {
> | int ret;
> | struct mtdpstore_context *cxt = &oops_cxt;
> | struct pstore_blk_config *info = &cxt->info;
> |
> | ret = pstore_blk_get_config(info);
> | if (unlikely(ret))
> | return ret;
> |
> | if (strlen(info->device) == 0) {
> | pr_err("mtd device must be supplied (device name is empty)\n");
> ...
>
> [...]
Applied to for-next/pstore, thanks!
[1/1] pstore/blk: replace deprecated strncpy with strscpy
https://git.kernel.org/kees/c/80b735d01bbb
Take care,
--
Kees Cook
Powered by blists - more mailing lists