> Date: Fri, 19 Dec 2008 22:23:52 +0100 > From: Roland Mainz <roland.mainz at nrubsig.org> > Subject: Re: PSARC/2008/778 - asprintf, vasprintf > To: Nicolas Williams <Nicolas.Williams at Sun.COM> > Cc: "Roger A. Faulkner" <Roger.Faulkner at Sun.COM>, psarc-ext at > sac.sfbay.sun.com, Daniel.Price at Sun.COM, Peter.Memishian at Sun.COM > X-Brightmail-Tracker: AAAAAA== > X-Virus-Scanned: ClamAV 0.94.1/8786/Fri Dec 19 11:30:31 2008 on mail-in-12.arcor-online.net > X-Virus-Status: Clean > X-Antispam: No, score=0.0/5.0, scanned in 0.056sec at (localhost [127.0.0.1]) by smf-spamd v1.3.1 - http://smfs.sf.net/ > > Nicolas Williams wrote: > > On Fri, Dec 19, 2008 at 09:14:37PM +0100, Roland Mainz wrote: > > > Will this even work if another library is used for |malloc()|&&|free()| > > > calls (IMO it should work but I am not sure about the case when an > > > application is linked via -B direct) ? > > > > Yes, it will: malloc() and friends are marked as NODIRECT in libc, which > > means they can be interposed on freely by the application, even when > > they are called from within libc itself. > > Devils advocate question: > What happens if someone intercepts |asprintf()| or |vasprintf()| with > his/her own function which doesn't use the default |malloc()| () ? > > ---- > > Bye, > Roland
They must conform to the specification (from Linux and *BSD and now Solaris) that the pointer obtained from [v]asprintf() is to be the subject of free() when no longer needed. Otherwise, they have just shot themselves in the foot. What else did you expect? Roger
