
On Wed, Aug 02, 2023 at 12:06:26PM +0200, Matthias Schiffer wrote:
On Fri, 2023-07-14 at 13:24 +0200, Matthias Schiffer wrote:
Both the Linux kernel and libbsd agree that strlcpy() should always return strlen(src) and not include the NUL termination. The incorrect U-Boot implementation makes it impossible to check the return value for truncation, and breaks code written with the usual implementation in mind (for example, fdtdec_add_reserved_memory() was subtly broken).
I reviewed all callers of strlcpy() and strlcat() and fixed them according to my understanding of the intended function.
This reverts commit d3358ecc54be0bc3b4dd11f7a63eab0a2842f772 and adds related fixes.
Fixes: d3358ecc54be ("lib: string: Fix strlcpy return value") Signed-off-by: Matthias Schiffer matthias.schiffer@ew.tq-group.com
Ping~
strlcpy and strlcat are now also in glibc and might be added to POSIX, so it would be great if we could get the U-Boot implementation to match the common behaviour.
I intend to pull this in to -next when I open it post -rc2, thanks.