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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Jun 2022 11:46:16 -0600
From:   Mathieu Poirier <mathieu.poirier@...aro.org>
To:     Saud Farooqui <farooqui_saud@...mail.com>
Cc:     bjorn.andersson@...aro.org, linux-remoteproc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rpmsg: strcpy is not safe, use strncpy

Hi Saud,

On Wed, Jun 08, 2022 at 11:43:30PM +0500, Saud Farooqui wrote:
> Replace strcpy with strncpy for copying the rpmsg
> device name in rpmsg_register_device_override
> 
> Signed-off-by: Saud Farooqui <farooqui_saud@...mail.com>
> ---
>  drivers/rpmsg/rpmsg_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index 290c1f02da10..d3b29c19715d 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -604,7 +604,7 @@ int rpmsg_register_device_override(struct rpmsg_device *rpdev,
>  	int ret;
>  
>  	if (driver_override)
> -		strcpy(rpdev->id.name, driver_override);
> +		strncpy(rpdev->id.name, driver_override, sizeof(rpdev->id.name));

Please use strscpy_pad() instead of strncpy().

Thanks,
Mathieu

>  
>  	dev_set_name(dev, "%s.%s.%d.%d", dev_name(dev->parent),
>  		     rpdev->id.name, rpdev->src, rpdev->dst);
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ