[Info-vax] C str calls
Craig A. Berry
craigberry at nospam.mac.com
Sat Aug 22 14:56:41 EDT 2015
On 8/22/15 12:13 PM, Simon Clubley wrote:
> the problem with strncpy() is that the result
> may not be null terminated. This was a _really_ stupid design decision
> for something that was supposed to be safer than strcpy().
I've read somewhere that strncpy was never intended to be safer; it was
designed for handling fixed-length, null-padded strings that were once
common in older Unix system interfaces. Then people started recommending
it for safety because it was the only standard function that provided
some form of bounds checking.
More information about the Info-vax
mailing list