Bug in talloc_asprintf_append()

Jeremy Allison jra at samba.org
Fri Sep 14 16:45:20 GMT 2007


On Fri, Sep 14, 2007 at 06:34:11PM +0200, Volker Lendecke wrote:
> On Wed, Sep 12, 2007 at 02:15:40PM -0700, Jeremy Allison wrote:
> > > 	/* talloc a 10 byte string. */
> > > 	char *s = talloc_strdup(NULL, "0123456789");
> > > 
> > > 	s[5] = '\0';
> > > 
> > > 	s = talloc_asprintf_append(s,
> > > 				"%s",
> > > 				"56789");
> 
> Sorry, but this is an illegal use of that API. This was
> meant to handle huge strings in winbind for the extra_data
> stuff efficiently without having to go over the existing
> string over and over again. If you keep it this way, I will
> add a function that does exactly what talloc_asprintf_append
> did before.

If this is an illegal use of that api, then that api is
the worst named function in the entire universe :-).

Can we leave this one as-is (least suprises) and add
a function with a name that actually means what it
does, that will do what you need ?

Jeremy.


More information about the samba-technical mailing list