summaryrefslogtreecommitdiff
path: root/fs/ext4/inline.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2025-07-12 14:12:48 -0400
committerTheodore Ts'o <tytso@mit.edu>2025-07-17 23:25:21 -0400
commita35454ecf8a320c49954fdcdae0e8d3323067632 (patch)
treeedf900a21a3a4538cdb3b3812b6f5bc8f1239dff /fs/ext4/inline.c
parent3658b8b3398eb2a49ee8d1ac88e5cdc41764f1c9 (diff)
ext4: use memcpy() instead of strcpy()
The strcpy() function is considered dangerous and eeeevil by people who are using sophisticated code analysis tools such as "grep". This is true even when a quick inspection would show that the source is a constant string ("." or "..") and the destination is a fixed array which is guaranteed to have enough space. Make the "grep" code analysis tool happy by using memcpy() isstead of strcpy(). :-) Signed-off-by: Theodore Ts'o <tytso@mit.edu> Link: https://patch.msgid.link/20250712181249.434530-2-tytso@mit.edu Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r--fs/ext4/inline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 121279f84bef..77e8b7707650 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1317,7 +1317,7 @@ int ext4_inlinedir_to_tree(struct file *dir_file,
if (pos == 0) {
fake.inode = cpu_to_le32(inode->i_ino);
fake.name_len = 1;
- strcpy(fake.name, ".");
+ memcpy(fake.name, ".", 2);
fake.rec_len = ext4_rec_len_to_disk(
ext4_dir_rec_len(fake.name_len, NULL),
inline_size);
@@ -1327,7 +1327,7 @@ int ext4_inlinedir_to_tree(struct file *dir_file,
} else if (pos == EXT4_INLINE_DOTDOT_OFFSET) {
fake.inode = cpu_to_le32(parent_ino);
fake.name_len = 2;
- strcpy(fake.name, "..");
+ memcpy(fake.name, "..", 3);
fake.rec_len = ext4_rec_len_to_disk(
ext4_dir_rec_len(fake.name_len, NULL),
inline_size);