From d26ddde6c2033f12a7a7c9bcca2b9134ee5bf417 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Sun, 17 Sep 2023 14:09:52 +0200 Subject: [PATCH] Fixes va_list in strbuf being left uninitialized (causes MSVC to crash) * Ref https://github.com/SanderMertens/flecs/pull/1036 --- util/src/strbuf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/src/strbuf.c b/util/src/strbuf.c index 368e0d0..08f2caa 100644 --- a/util/src/strbuf.c +++ b/util/src/strbuf.c @@ -21,6 +21,8 @@ #include +#define UT_VA_INIT (va_list){0} + /* Add an extra element to the buffer */ static void ut_strbuf_grow( @@ -277,7 +279,7 @@ bool ut_strbuf_appendstrn( const char* str, int64_t len) { - va_list args; + va_list args = UT_VA_INIT; return ut_strbuf_append_intern( b, str, len, false, args ); @@ -307,7 +309,7 @@ bool ut_strbuf_appendstr( ut_strbuf *b, const char* str) { - va_list args; + va_list args = UT_VA_INIT; return ut_strbuf_append_intern( b, str, -1, false, args );