public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Ethan Carter Edwards <ethan@ethancedwards.com>
To: Theodore Ts'o <tytso@mit.edu>,
	 Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-hardening@vger.kernel.org,
	 Ethan Carter Edwards <ethan@ethancedwards.com>
Subject: [PATCH] ext4: replace strcpy() with strscpy() in ext4_init_dot_dotdot()
Date: Sun, 18 May 2025 12:48:50 -0400	[thread overview]
Message-ID: <20250518-ext4-strcpy-v1-1-6c8a82ff078f@ethancedwards.com> (raw)

strcpy() is deprecated; use strscpy() instead.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/88
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
 fs/ext4/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index e9712e64ec8f04586f5ebcd332431e6af92e4f36..85df7fbf8ebd2c5b2aa3a20813f5f8a1aec7f5b7 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2926,7 +2926,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
 	de->name_len = 1;
 	de->rec_len = ext4_rec_len_to_disk(ext4_dir_rec_len(de->name_len, NULL),
 					   blocksize);
-	strcpy(de->name, ".");
+	strscpy(de->name, ".");
 	ext4_set_de_type(inode->i_sb, de, S_IFDIR);
 
 	de = ext4_next_entry(de, blocksize);
@@ -2940,7 +2940,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
 		de->rec_len = ext4_rec_len_to_disk(
 					ext4_dir_rec_len(de->name_len, NULL),
 					blocksize);
-	strcpy(de->name, "..");
+	strscpy(de->name, "..");
 	ext4_set_de_type(inode->i_sb, de, S_IFDIR);
 
 	return ext4_next_entry(de, blocksize);

---
base-commit: 5723cc3450bccf7f98f227b9723b5c9f6b3af1c5
change-id: 20250518-ext4-strcpy-1545c6f79b51

Best regards,
-- 
Ethan Carter Edwards <ethan@ethancedwards.com>


             reply	other threads:[~2025-05-18 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-18 16:48 Ethan Carter Edwards [this message]
2025-05-19  3:26 ` [PATCH] ext4: replace strcpy() with strscpy() in ext4_init_dot_dotdot() Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250518-ext4-strcpy-v1-1-6c8a82ff078f@ethancedwards.com \
    --to=ethan@ethancedwards.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox