[Bf-committers] fix to #2117
Stephen Swaney
sswaney at centurytel.net
Tue Jan 25 04:25:32 CET 2005
On Mon, Jan 24, 2005 at 08:00:07PM +0100, Alexander Ewering wrote:
>
>
> No, it doesn't solve it, you still get a non-terminated string.
Ahhm. the PyOS_snprintf() call produces a nice null terminated string.
> BLI_strncpy( self->name, name, strlen( name ) + 1 );
>
> What in god's name does strncpy(bleh,blah,strlen(blah)+1) do
> differently to strcpy(bleh,blah) ?
the difference between strcpy() and strncpy() is that the latter only
copies a maximum number of characters.
The nice feature of the BLI_strncpy() wrapper is that it gives you a
null terminator, too.
--
Stephen Swaney
sswaney at centurytel.net
More information about the Bf-committers
mailing list