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] [thread-next>] [day] [month] [year] [list]
Message-ID: <25c76729-69b8-4ed1-affd-bad92b1069d9@linux.alibaba.com>
Date: Wed, 19 Nov 2025 13:31:38 +0800
From: Joseph Qi <joseph.qi@...ux.alibaba.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>, Mark Fasheh <mark@...heh.com>,
 Joel Becker <jlbec@...lplan.org>, akpm <akpm@...ux-foundation.org>
Cc: ocfs2-devel@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] ocfs2: Replace deprecated strcpy in
 ocfs2_create_xattr_block



On 2025/11/19 02:53, Thorsten Blum wrote:
> strcpy() has been deprecated [1] because it performs no bounds checking
> on the destination buffer, which can lead to buffer overflows. Replace
> it with the safer strscpy(), and copy directly into '->xb_signature'
> instead of using the start of the struct as the destination buffer.
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@...ux.alibaba.com>

> ---
>  fs/ocfs2/xattr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index d70a20d29e3e..73c028f452ac 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -2908,7 +2908,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
>  	/* Initialize ocfs2_xattr_block */
>  	xblk = (struct ocfs2_xattr_block *)new_bh->b_data;
>  	memset(xblk, 0, inode->i_sb->s_blocksize);
> -	strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE);
> +	strscpy(xblk->xb_signature, OCFS2_XATTR_BLOCK_SIGNATURE);
>  	xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot);
>  	xblk->xb_suballoc_loc = cpu_to_le64(suballoc_loc);
>  	xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ