lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH4c4j+XskhzM-Kuv+gTAaBL8o+63kbOPGS6xqQYQ3_Fd0UMCA@mail.gmail.com>
Date: Thu, 10 Jul 2025 18:59:05 +0530
From: Pranav Tyagi <pranav.tyagi03@...il.com>
To: martin.petersen@...cle.com, linux-scsi@...r.kernel.org, 
	target-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] target/core: replace strncpy with strscpy

On Sun, Jul 6, 2025 at 2:55 PM Pranav Tyagi <pranav.tyagi03@...il.com> wrote:
>
> strncpy() is deprecated and its use is discouraged. Replace strncpy()
> with safer strscpy() as the p_buf buffer should be NUL-terminated, since
> it holds human readable debug output strings.
>
> Signed-off-by: Pranav Tyagi <pranav.tyagi03@...il.com>
> ---
>  drivers/target/target_core_transport.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 0a76bdfe5528..9c255ed21789 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -1112,7 +1112,7 @@ void transport_dump_vpd_proto_id(
>         }
>
>         if (p_buf)
> -               strncpy(p_buf, buf, p_buf_len);
> +               strscpy(p_buf, buf, p_buf_len);
>         else
>                 pr_debug("%s", buf);
>  }
> @@ -1162,7 +1162,7 @@ int transport_dump_vpd_assoc(
>         }
>
>         if (p_buf)
> -               strncpy(p_buf, buf, p_buf_len);
> +               strscpy(p_buf, buf, p_buf_len);
>         else
>                 pr_debug("%s", buf);
>
> @@ -1222,7 +1222,7 @@ int transport_dump_vpd_ident_type(
>         if (p_buf) {
>                 if (p_buf_len < strlen(buf)+1)
>                         return -EINVAL;
> -               strncpy(p_buf, buf, p_buf_len);
> +               strscpy(p_buf, buf, p_buf_len);
>         } else {
>                 pr_debug("%s", buf);
>         }
> @@ -1276,7 +1276,7 @@ int transport_dump_vpd_ident(
>         }
>
>         if (p_buf)
> -               strncpy(p_buf, buf, p_buf_len);
> +               strscpy(p_buf, buf, p_buf_len);
>         else
>                 pr_debug("%s", buf);
>
> --
> 2.49.0
>
Hi,

This is a gentle follow-up on this patch. I would like to
know if there is any update on its state.

Regards
Pranav Tyagi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ