This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FAQ about strlcpy/strlcat ?


On 05/21/2012 08:25 AM, Frank Ch. Eigler wrote:

> I asked only because the strlcpy documentation I've seen has never
> advised that the function is supposed to catch any errors at all

Buffer overruns were the main motivation.  I added a URL to the wiki,
pointing to the original strlcpy paper, to help clarify this.

> Or perhaps I misunderstood: does the sentence regarding Annex K talk
> exclusively about strcpy_s and strcat_s?  If so, criticizing these is
> at best counterproductive to criticizing strl*.

Sorry, I don't follow.  The sentence regarding Annex K is talking
only about strcpy_s and strcat_s (not the other Annex K functions).
But the criticisms apply that apply to strlcpy / strlcat also apply
to strcpy_s / strcat_s, so why not mention both sets of functions?

> If the faq advises snprintf(), strcpy_s() as a substitute for strlcpy,
> it should keep its relative inefficiency/complexity comparisons to
> that.

Thanks, I added a comment to that effect.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]