Re: [PATCH] crypto: hisilicon - fix strncpy warning with strlcpy

From: Eric Biggers
Date: Wed Jun 10 2020 - 02:56:06 EST


On Sun, Jun 07, 2020 at 01:03:45PM +0000, David Laight wrote:
> From: Herbert Xu
> > Sent: 05 June 2020 13:17
> ...
> > Better yet use strscpy which will even return an error for you.
>
> It really ought to return the buffer length on truncation.
> Then you can loop:
> while(...)
> buf += strxxxcpy(buf, src, buf_end - buf);
> and only check right at the end.
>
> David

scnprintf() can be used for that.

But that doesn't seem relevant to this patch.

- Eric