Re: ctdb debug vasprintf memory overwrite in ib 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@samba.org

