tools/nolibc/string: add tiny versions of strncat() and strlcat()
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Feb 2022 16:23:43 +0000 (17:23 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 14 Feb 2022 18:48:54 +0000 (10:48 -0800)
commit14c1d43d886afe7e5f0cc7311b3fa99da047d006
treea0db25b7cb94ced91949bcc4406f574ddaf8f921
parentff94ad06a0bb29f3e8467a3689be685a05f6d8b4
tools/nolibc/string: add tiny versions of strncat() and strlcat()

While these functions are often dangerous, forcing the user to work
around their absence is often much worse. Let's provide small versions
of each of them. The respective sizes in bytes on a few architectures
are:

  strncat(): x86:0x33 mips:0x68 arm:0x3c
  strlcat(): x86:0x25 mips:0x4c arm:0x2c

The two are quite different, and strncat() is even different from
strncpy() in that it limits the amount of data it copies and will always
terminate the output by one zero, while strlcat() will always limit the
total output to the specified size and will put a zero if possible.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/string.h