> Date: Wed, 28 Jul 2010 09:25:10 +1000
> From: Peter Hutterer <peter.hutte...@who-t.net>
> 
> On Tue, Jul 27, 2010 at 03:09:55PM +0300, Pauli Nieminen wrote:
> > Source and destination have well defined size so use memcpy instead of
> > strncpy. strncpy tryes to add NULL to end of destination but it is not
>                    ^ "tries"
> > possible if source doesn't have NULL.
> 
> my strncpy man page claims that if there is "no null byte among the first n
> bytes of src, the string placed in dest will not be null terminated." That's
> counter to what the message above says.

That's correct.  It's why strlcpy(3) was invented in the non-Linux
world; strlcpy(3) guarantees that the copied string is
null-terminated.

So I agree with Peter that this change doesn't make a lot of sense.
Potentially strncpy(3) will be faster than memcpy(3) since it will
stop copying after a null character.
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to