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: <c2072355-157a-4fd3-9635-c94b7167e637@stanley.mountain>
Date: Mon, 6 Jan 2025 12:55:08 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Ethan Carter Edwards <ethan@...ancedwards.com>
Cc: "t.sailer@...mni.ethz.ch" <t.sailer@...mni.ethz.ch>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-hams@...r.kernel.org" <linux-hams@...r.kernel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>
Subject: Re: [PATCH] hamradio: baycom: replace strcpy() with strscpy()

On Mon, Dec 23, 2024 at 03:13:42PM +0000, Ethan Carter Edwards wrote:
> The strcpy() function has been deprecated and replaced with strscpy().
> There is an effort to make this change treewide:
> https://github.com/KSPP/linux/issues/88.
> 
> Signed-off-by: Ethan Carter Edwards <ethan@...ancedwards.com>
> ---
>  drivers/net/hamradio/baycom_par.c     | 4 ++--
>  drivers/net/hamradio/baycom_ser_fdx.c | 2 +-
>  drivers/net/hamradio/baycom_ser_hdx.c | 4 ++--
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
> index 00ebc25d0b22..47bc74d3ad8c 100644
> --- a/drivers/net/hamradio/baycom_par.c
> +++ b/drivers/net/hamradio/baycom_par.c
> @@ -427,7 +427,7 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
>                 break;
> 
>         case HDLCDRVCTL_GETMODE:
> -               strcpy(hi->data.modename, bc->options ? "par96" : "picpar");
> +               strscpy(hi->data.modename, bc->options ? "par96" : "picpar", sizeof(hi->data.modename));

strscpy() has macro magic so you can just write this as:

	strscpy(hi->data.modename, bc->options ? "par96" : "picpar");

Looks nicer and it's easier to review.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ