svn commit: samba r22743 - in branches/SAMBA_4_0/source/lib/charset: .

simo idra at samba.org
Mon May 7 14:15:27 GMT 2007


On Mon, 2007-05-07 at 13:32 +0000, metze at samba.org wrote:
> Author: metze
> Date: 2007-05-07 13:32:34 +0000 (Mon, 07 May 2007)
> New Revision: 22743
> 
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22743
> 
> Log:
> set the talloc name to the string...

Metze this will horribly break as soon as you realloc() the string and
the glibc returns a different pointer. As soon as that happens, tc->name
will be an invalid pointer.

You really don't want this into a generic function that returns char *
(without const).

Also the comment makes it clear that we do in fact use the return to
append strings (which means we do realloc it routinely).

talloc_set_name_const() must be used _only_ with real const values as
the name suggests. And copying the value would be a waste of memory and
will get outdated after further manipulation.

Can you revert?

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org



More information about the samba-technical mailing list