Re:Massacring C Pointers
by heisenbit on Tuesday June 26, 2018 @02:02PM
(#17402757)
A misname that may have cost cost billions in bugs and security issues.
[ Parent
| on HN ]
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.