cvs commit: src/lib/libutil login_times.c

Robert Watson rwatson at FreeBSD.org
Mon Jan 16 06:11:11 PST 2006


On Mon, 16 Jan 2006, Bruce Evans wrote:

>>  Restore use of strncpy(), as there is later unconditional termination
>>  of the string, and reliance on the returned pointer.
>> 
>>  Found by:  bde (tm)
>
> Thanks.  Heheh.
>
> I didn't actually notice the reliance on the returned pointer.  This is a 
> good example that even trivial changes need testing.  (p = strncpy(...) was 
> changed to p = strlcpy(...), but strncpy() returns "char *" while strlcpy() 
> returns size_t, so the code fails compile-time testing provided error output 
> is noticed.)

A lesson that can be learned a surprising number of times and still not 
entirely stick.  Oh well :-).

Thanks,

Robert N M Watson


More information about the cvs-src mailing list