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: <20230109194834.24e06def@kernel.org>
Date:   Mon, 9 Jan 2023 19:48:34 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     <yang.yang29@....com.cn>
Cc:     <santosh.shilimkar@...cle.com>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <pabeni@...hat.com>,
        <netdev@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
        <rds-devel@....oracle.com>, <linux-kernel@...r.kernel.org>,
        <xu.panda@....com.cn>
Subject: Re: [PATCH net-next] net/rds: use strscpy() to instead of strncpy()

On Mon, 9 Jan 2023 19:48:43 +0800 (CST) yang.yang29@....com.cn wrote:
>  		BUG_ON(strlen(names[i]) >= sizeof(ctr.name));
> -		strncpy(ctr.name, names[i], sizeof(ctr.name) - 1);
> -		ctr.name[sizeof(ctr.name) - 1] = '\0';
> +		strscpy(ctr.name, names[i], sizeof(ctr.name));

You can make use of the fact that strscpy returns useful information
and the copy and the preceding BUG_ON() together. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ