[Bf-committers] fix to #2117
Joilnen Batista Leite
vma_bad_list at yahoo.com
Mon Jan 24 23:55:08 CET 2005
well,
here is BLI_strncpy code:
char *BLI_strncpy(char *dst, char *src, int maxncpy) {
int srclen= strlen(src);
int cpylen=
(srclen>(maxncpy-1))?(maxncpy-1):srclen;
memcpy(dst, src, cpylen);
dst[cpylen]= '\0';
return dst;
}
seems to return a terminated string for me.
thnaks to consider.
Joilnen (pidhash)
--- Alexander Ewering <blender at instinctive.de> wrote:
>
> On Mon, 24 Jan 2005, Joilnen Batista Leite wrote:
>
> > Hi guys !
> >
> > I think that it can solve that overflow
>
> No, it doesn't solve it, you still get a
> non-terminated string.
>
> And looking at the old code... I wonder if the whole
> Python interface
> is coded like that.
>
> 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) ?
>
> | alexander ewering instinctive
> mediaworks
> | ae[@]instinctive[.]de
> http://www[.]instinctive[.]de
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
>
http://projects.blender.org/mailman/listinfo/bf-committers
>
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
More information about the Bf-committers
mailing list