ctdb debug vasprintf memory overwrite in ib

James Peach jpeach at samba.org
Fri Apr 20 15:57:40 GMT 2007


On 20/04/2007, at 4:09 AM, Peter Somogyi wrote:

[snip]

> Picking another vasprintf implementation like this solves my problem:
>
> int vasprintf(char **ptr, const char *format, va_list ap)
> {
>    int ret;
>    va_list tmp_ap;
>
>    va_copy(tmp_ap, ap);
>    ret = vsnprintf(NULL, 0, format, tmp_ap);

Note that you can't rely on this returning the number of characters  
that would have been output if the buffer were large enough until C99  
or UNIX98 IIRC.

--
James Peach | jpeach at samba.org



More information about the samba-technical mailing list