Re: [PATCH 2/3] ext4: use memcpy() instead of strcpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux