4 ms·
I think you are right. `strlcpy` is only supposed to copy `n-1` bytes from src to dest. https://github.com/freebsd/freebsd/blob/master/sys/libkern/strlcpy.c#L2
by harikb 6y ago
I think you are right. `strlcpy` is only supposed to copy `n-1` bytes from src to dest.
https://github.com/freebsd/freebsd/blob/master/sys/libkern/strlcpy.c#L26 https://github.com/freebsd/freebsd/blob/master/sys/libkern/s...
- ben_bai 6y agostrlcpy always NUL terminates the string (that is it's big selling point). So it copies up to n-1 bytes from src to destination. If src was bigger then destination it is truncated and n-th byte is set to NUL.