[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <169818232969.2100071.3919289615593947459.b4-ty@chromium.org>
Date: Tue, 24 Oct 2023 14:18:51 -0700
From: Kees Cook <keescook@...omium.org>
To: Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...nel.org>, dm-devel@...hat.com,
Justin Stitt <justinstitt@...gle.com>
Cc: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] dm ioctl: replace deprecated strncpy with strscpy_pad
On Mon, 25 Sep 2023 06:54:51 +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 expect `spec->target_type` to be NUL-terminated based on its use with
> a format string after `dm_table_add_target()` is called
> | r = dm_table_add_target(table, spec->target_type,
> | (sector_t) spec->sector_start,
> | (sector_t) spec->length,
> | target_params);
> ... wherein `spec->target_type` is passed as parameter `type` and later
> printed with DMERR:
> | DMERR("%s: %s: unknown target type", dm_device_name(t->md), type);
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] dm ioctl: replace deprecated strncpy with strscpy_pad
https://git.kernel.org/kees/c/0f3f34ea3798
Take care,
--
Kees Cook
Powered by blists - more mailing lists