Overview of strlcpy/strlcat support in different C runtimes
The table below shows, with references, which C run-time environments support the strlcpy and strlcat functions.
System' |
Availability |
Compatibility |
AIX |
no |
na |
avr-libc |
full* |
|
Bionic |
full |
|
Cygwin |
full |
|
dietlibc |
basic |
|
Embarcardero |
no |
na |
FreeBSD |
full |
|
glibc |
no |
na |
HardenedBSD |
? |
|
HP-UX |
no |
na |
Illumos |
full |
|
Interix |
? |
|
Keil |
? |
|
klibc |
full* |
|
newlib |
(see Cygwin) |
|
Mac OS X |
full |
|
MSVCRT |
no |
na |
musl |
full |
|
NetBSD |
full |
|
OpenBSD |
full |
|
OpenWatcom |
basic* |
|
QNX |
? |
|
Solaris |
(see Illumos) |
|
uClibc |
full* |
|
vxWorks |
no |
na |
Compatibility is tested using https://pagure.io/strlcpy-tests. The following tests are performed:
Basic functionality tests, including truncation. The destination buffer does not have zero length, and for strlcat, the existing buffer contents is NUL-terminated.
Zero-length destination buffers for strlcpy and strlcat.
Destination buffer which is not NUL-terminated with strlcat.
These tests do not cover the behavior with overlapping inputs and outputs, which is difficult to test conclusively.
The reported compatibility levels are:
full All tests above pass.
full* Like full, but tests were performed after recompilation in a GNU/Linux environment.
basic' Only the first test (basic functionality) passes. The other tests result in crashes.
basic* Like basic, but tests were performed after recompilation in a GNU/Linux environment.