Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33787 )
Change subject: libpayload/libc: Correct strlcat return value ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/#/c/33787/1/payloads/libpayload/libc/string.c File payloads/libpayload/libc/string.c:
https://review.coreboot.org/#/c/33787/1/payloads/libpayload/libc/string.c@25... PS1, Line 257: int dl = strlen(d);
Honestly, this whole implementation is kinda gnarly. […]
Due to the truncation issue this isn't quite correct. If we're going to replace the whole function then I kinda feel like just copying the one from OpenBSD, which is what Patrick did when he added strlcpy.c
https://review.coreboot.org/#/c/33787/1/payloads/libpayload/libc/string.c@26... PS1, Line 267: return sl + dl;
This is incorrect if the result was truncated.
Sorry, I should have been more clear. The return value should be the length of the concatenated string that would have been created without any truncation.