3 ms·
It has also avoided security issues, some of which get created when people get the idea that every strncpy must be replaced by strlcpy. The strncpy function wr
by burfog 8y ago
It has also avoided security issues, some of which get created when people get the idea that every strncpy must be replaced by strlcpy.
The strncpy function writes to the entire buffer. This is important if you will be passing the buffer across a security boundary, for example in a network packet or as a struct copied into a publicly visible file. If trailing bytes are not cleared, then secret data (which happened to be sitting in memory) can get leaked.