ocfs2: replace deprecated strcpy in ocfs2_create_xattr_block
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 18 Nov 2025 18:53:44 +0000 (19:53 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 20 Nov 2025 22:03:45 +0000 (14:03 -0800)
commit4022ba20050e8e2bb189155e0665b60953d7552c
tree15f6b0697d2f2497d8ce4130af0ff1e5bb477fd8
parentff713698bad2e7d052960cf182fa1ab465564dfd
ocfs2: replace deprecated strcpy in ocfs2_create_xattr_block

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
Link: https://lkml.kernel.org/r/20251118185345.132411-2-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/xattr.c