Skip to contentSkip to conversation

orangefs_inode_getxattr(): replace deprecated strcpy with strscpy

PATCH New Daniel Yang 1 participant 1 message Nov 6, 2024 Orangefs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orangefs_inode_getxattr(): replace deprecated strcpy with strscpy

The strcpy() function does not do bounds checking. strscpy() is the recommended replacement to the deprecated function. The return value of strcpy is not used so there shouldn't be issues here.

---
 fs/orangefs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/xattr.c +1 -1
index 74ef75586..d27ff38cf 100644
@@ -150,7 +150,7 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name,
 		goto out_unlock;
 
 	new_op->upcall.req.getxattr.refn = orangefs_inode->refn;
-	strcpy(new_op->upcall.req.getxattr.key, name);
+	strscpy(new_op->upcall.req.getxattr.key, name);
 
 	/*
 	 * NOTE: Although keys are meant to be NULL terminated textual
Signature · 1 line
2.39.5