Fixed repeated use of va_list.

Problem: va_list contents after first call of vsnprintf() are undefined. So if a buffer resize is needed, SIGSEGV occurs.

Proposed solution: I opted to use va_copy() in the patch below, which is from C99 (I don't know if it's ok). I am also only familiar with POSIX, so I didn't touch win32 code path.