Fix missing null terminator bug on Windows

(v)sprintf_s doesn't append a '\0' to the final string if the buffer is
too small.