[Info-vax] C str calls
Simon Clubley
clubley at remove_me.eisner.decus.org-Earth.UFP
Sat Aug 22 13:13:01 EDT 2015
On 2015-08-22, Stephen Hoffman <seaohveh at hoffmanlabs.invalid> wrote:
>
> Where available, the BSD-derived strl string calls can be preferable to
> the str calls and even to the strn calls, as the strl string calls are
> intended to avoid various common buffer overruns.
>
To make that more clear, 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().
strncpy() only stops you from walking off into never-never land while
processing the source argument.
Simon.
--
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world
More information about the Info-vax
mailing list