This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: asprintf() issue


On 05/13/2015 12:14 PM, Joseph Myers wrote:
> Does anyone know of implementations that do something other than leaving 
> the value unchanged or setting it to NULL?  The external specifications in 
> question are LSB and TR 24731-2:2010 (which defers to LSB), and they seem 
> to be silent on this issue.

Windows lacks asprintf, Solaris lacks asprintf, HPUX lacks asprintf,
so we have little guidance from these OSs.

I know of no other implementations that do something other than leave the
value unchanged or set to NULL.

My preference is that we set it to NULL. This will aid in debugging as any
dereferences to NULL will immediately trap. Leaving the value unchanged
could result in further manipulation of an invalid memory location and
program corruption.

This is in line with what the BSDs do, and therefore aids in porting code
between them.

So +1 to set it to NULL.

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]