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]
Message-ID: <9f38f4aa-c6b5-4786-a641-d02d8bd92f7f@acm.org>
Date:   Tue, 24 Oct 2023 13:01:51 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Justin Stitt <justinstitt@...gle.com>,
        Hannes Reinecke <hare@...e.de>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] scsi: fcoe: replace deprecated strncpy with strscpy

On 10/24/23 12:52, Justin Stitt wrote:
> diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
> index e17957f8085c..7a3ca6cd3030 100644
> --- a/drivers/scsi/fcoe/fcoe_sysfs.c
> +++ b/drivers/scsi/fcoe/fcoe_sysfs.c
> @@ -279,12 +279,10 @@ static ssize_t store_ctlr_mode(struct device *dev,
>   	if (count > FCOE_MAX_MODENAME_LEN)
>   		return -EINVAL;
>   
> -	strncpy(mode, buf, count);
> +	strscpy(mode, buf, count);
>   
>   	if (mode[count - 1] == '\n')
>   		mode[count - 1] = '\0';
> -	else
> -		mode[count] = '\0';
>   
>   	switch (ctlr->enabled) {
>   	case FCOE_CTLR_ENABLED:

Please consider to remove the code for copying the sysfs string and to
use sysfs_match_string() instead.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ