vallocPrintf()
first calls vsnprintf() with a length argument of zero to determine
the necessary buffer size, allocates a buffer and then calls
size2 = vsprintf(buf,format,args)
It then goes on and complains if size2 is different from what the
initial vsnprintf() returned.
If, however, this really happens (and I have observed this under
64-bit ubuntu-12.10)
then it is well possible that vsprintf() writes beyond the length of
the buffer.
Hence, I suggest to replace vsprintf() by
size2 = vsnprintf(buf, size+1, format, args)
just to make sure. (Note that the 'size' argument to snprintf()
includes space for
the terminating NUL whereas the return value does not.)
- Till
A patch is attached for sake of convenience.