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