[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <174165505011.528513.5802380818483016300.b4-ty@oracle.com>
Date: Mon, 10 Mar 2025 21:19:08 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
linux-hardening@...r.kernel.org, linux-scsi@...r.kernel.org,
target-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] scsi: target: Replace deprecated strncpy() with strscpy()
On Sun, 02 Mar 2025 23:56:41 +0100, Thorsten Blum wrote:
> strncpy() is deprecated for NUL-terminated destination buffers; use
> strscpy() instead. The destination buffer db_root is only used with "%s"
> format strings and must therefore be NUL-terminated, but not NUL-padded.
>
> Use scnprintf() because snprintf() could return a value >= DB_ROOT_LEN
> and lead to an out-of-bounds access. This doesn't happen because count
> is explicitly checked against DB_ROOT_LEN before. However, scnprintf()
> always returns the number of characters actually written to the string
> buffer, which is always within the bounds of db_root_stage, and should
> be preferred over snprintf().
>
> [...]
Applied to 6.15/scsi-queue, thanks!
[1/1] scsi: target: Replace deprecated strncpy() with strscpy()
https://git.kernel.org/mkp/scsi/c/dfb7df1ddb29
--
Martin K. Petersen Oracle Linux Engineering
Powered by blists - more mailing lists