svn commit: r292454 - head/bin/ed

Pedro Giffuni pfg at FreeBSD.org
Sat Dec 19 01:52:23 UTC 2015


> Il giorno 18/dic/2015, alle ore 18:46, Conrad Meyer <cem at FreeBSD.org> ha scritto:
> 
> On Fri, Dec 18, 2015 at 2:44 PM, Pedro Giffuni <pfg at freebsd.org> wrote:
>> Hi Warner;
>> 
>>> Il giorno 18/dic/2015, alle ore 17:01, Warner Losh <imp at bsdimp.com> ha scritto:
>>> 
>>> Isn’t strlcpy() the more appropriate interface? strncpy doesn’t guarantee NUL termination.
>>> 
>> 
>> Maybe, but we were using strcpy() which doesn’t guarantee NULL termination either
>> and things have been working. I also thought that portability may be specially important
>> for the stuff in bin/.
> 
> strcpy() does guarantee NUL termination.  Otherwise it would be useless.
> 

Yes , my bad.

I come from a non-C background and sometimes tend to (erronously) think the C library
designers would keep some consistency :-/.

I changed it to strlcpy() a while ago.

Pedro.



More information about the svn-src-head mailing list