This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: asprintf() issue
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 12 May 2015 16:34:55 +0200
- Subject: Re: asprintf() issue
- Authentication-results: sourceware.org; auth=none
- References: <CANSoFxt-cdc-+C4u-rTENMtY4X9RpRSuv+axDswSPxbDgag8_Q at mail dot gmail dot com>
On 05/12/2015 03:53 PM, Archie Cobbs wrote:
> Hello,
>
> I have a question about asprintf(). There seems to be a practical issue with it.
>
> The man page states:
>
> If memory allocation wasn't possible, or some other error
> occurs, these functions will return -1, and the contents
> of strp is undefined.
>
> Note the "strp is undefined" part. This is correct, because there is
> apparently no explicit specification that says anything otherwise.
The glibc manual strongly implies that *strp is not updated on error,
and the code implements that.
The quoted manual page looks wrong. You can file a bug here:
<https://bugzilla.kernel.org/enter_bug.cgi?component=man-pages&product=Documentation>
--
Florian Weimer / Red Hat Product Security