Re: [PATCH] drivers/soc: Remove all strcpy() uses in favor of strscpy()

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

 



Hi,

On Wed, Jul 28, 2021 at 10:36:09AM +0100, Robin Murphy wrote:
> On 2021-07-28 09:36, David Laight wrote:

> > > > -               strcpy(pd->name, area->name);
> > > > +               strscpy(pd->name, area->name, area_name_size);
> >
> > You can just use memcpy().
>
> Indeed. In fact I'd go as far as saying that it might be worth teaching
> static checkers to recognise patterns that boil down to strscpy(dst, src,
> strlen(src) + 1) and flag them as suspect, because AFAICS that would always
> represent either an unnecessarily elaborate memcpy(), or far worse just an
> obfuscated strcpy().

Ok, I will use the memcpy function instead of strscpy. Thanks for the
feedback.

>
> Robin.

Regards,
Len




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux