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: [PATCH v4] Implement strlcpy [BZ #178]


On 11/04/2015 04:23 AM, Rich Felker wrote:
> There's certainly existing code that relies on strcpy not clobbering
> anything past the strlen(src)+1 bytes it writes. Naturally strcpy
> _can't_ do this because it has no way of knowing the dest buffer size.
> But to be able to use strlcpy as a safer drop-in replacement in such
> code, it would need to preserve this property.

Good.  I'm now convinced that there is such a requirement for strcpy,
fgets and so on.  I checked our documentation and the standard for
strcpy and fgets, and we do not explicitly specify this behavior
(although I agree it is implicit).  My question is whether we should
specify this explicitly for strlcpy.  It would give the impression that
strlcpy is special in this regard, but it really is not.

Florian


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