From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
linux-hardening@vger.kernel.org, ethan@ethancedwards.com
Subject: Re: [PATCH 2/3] ext4: use memcpy() instead of strcpy()
Date: Wed, 30 Jul 2025 17:02:41 +0200 [thread overview]
Message-ID: <aIo0EVzhbbLd89sV@black.igk.intel.com> (raw)
In-Reply-To: <20250712181249.434530-2-tytso@mit.edu>
On Sat, Jul 12, 2025 at 02:12:48PM -0400, Theodore Ts'o wrote:
> 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(). :-)
Why simple 2-arg strscpy() can't be used?
...
> - strcpy(fake.name, ".");
> + memcpy(fake.name, ".", 2);
s/strcpy/strscpy/
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-07-30 14:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-12 18:12 [PATCH 1/3] ext4: replace strcmp with direct comparison for '.' and '..' Theodore Ts'o
2025-07-12 18:12 ` [PATCH 2/3] ext4: use memcpy() instead of strcpy() Theodore Ts'o
2025-07-30 15:02 ` Andy Shevchenko [this message]
2025-07-12 18:12 ` [PATCH 3/3] ext4: refactor the inline directory conversion and new directory codepaths Theodore Ts'o
2025-07-12 21:12 ` kernel test robot
2025-07-21 23:15 ` Eric Biggers
2025-07-30 15:01 ` Andy Shevchenko
2025-07-19 21:45 ` [PATCH 1/3] ext4: replace strcmp with direct comparison for '.' and '..' 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=aIo0EVzhbbLd89sV@black.igk.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=ethan@ethancedwards.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-hardening@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.