]> git.dujemihanovic.xyz Git - u-boot.git/commit
Revert "lib: string: Fix strlcpy return value", fix callers
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Fri, 14 Jul 2023 11:24:50 +0000 (13:24 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 8 Aug 2023 21:05:43 +0000 (17:05 -0400)
commit615828721abfe8c73b5103d4436402ecbf9b9897
treebdd4cb11ef01155c17dfa51115eeff976bba05e7
parenta169438411f9277cc689c14078151aa1d1caae3c
Revert "lib: string: Fix strlcpy return value", fix callers

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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
board/amlogic/vim3/vim3.c
drivers/fastboot/fb_getvar.c
lib/string.c
test/lib/strlcat.c