From cfc576cefe8fbcd290428dee0e484d37a6a425c3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:56:35 -0600 Subject: [PATCH] appease MSVC C2131 --- fatal.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fatal.cc b/fatal.cc index 1352df64f..ecca26062 100644 --- a/fatal.cc +++ b/fatal.cc @@ -96,11 +96,13 @@ int DebugLog::vlog(const char* fmt, va_list args1) { va_list args2; va_copy(args2, args1); - char cbuf[1 + vsnprintf(nullptr, 0, fmt, args1)]; - vsnprintf(cbuf, sizeof cbuf, fmt, args2); + size_t cbufsz = 1 + vsnprintf(nullptr, 0, fmt, args1); + char* cbuf = new char[cbufsz]; + vsnprintf(cbuf, cbufsz, fmt, args2); va_end(args2); buf_.append(QString::asprintf("%s", cbuf)); + delete[] cbuf; int rc = 0;