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

From: David Laight
Date: Sun Jun 07 2020 - 09:03:53 EST


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

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)