Hi,
On Wed, Jul 28, 2021 at 10:36:09AM +0100, Robin Murphy wrote:
On 2021-07-28 09:36, David Laight wrote:
quoted
quoted
quoted
- 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