ac_json: Re-work json_vsnprintf() to avoid a crash in realloc()
ac_json: Re-work json_vsnprintf() to avoid a crash in realloc()

When we need to reallocate the json->str to make it bigger to handle
more data we would crash in the realloc() with something like

    realloc(): invalid next size: 0x00007fbcdc020540 ***

It seems this was due to the heap being corrupted by the previous call
to vsnprintf(). This was being called in a loop until we detected we had
enough room to store the new data.

Re-work this to use a single call vasprintf(3) which will allocate a
buffer big enough for the data.

We then loop round reallocating json->str until we have enough room to
append the buffer from vasprintf().

Also now since the indentation character can be more than a single '\t'
with commit f5bb9bc ("ac_json: Allow to set the indentation
character/string") we need to account for this space properly too.

Signed-off-by: Andrew Clayton <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@digital-domain.net>

ac000/libac