Is vsnprintf_s an appropriate replacement for deprecated vsnprintf?
Turns out this question is pretty much an exact duplicate of:
Calculating the size of an sprintf() buffer
Summary of the answer:
Use _vscprintf
to figure out how big the buffer should be, then use vsnprintf_s
to actually fill it.