From 64c86251ef4b136cd451dc96780880e4cc288460 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 31 Jul 2021 20:24:29 -0400 Subject: [PATCH] Null-terminate argvU8 array in wmain() wrapper. --- adapters/standalone.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapters/standalone.cpp b/adapters/standalone.cpp index cc67b057..d046d17f 100644 --- a/adapters/standalone.cpp +++ b/adapters/standalone.cpp @@ -264,11 +264,12 @@ int main(int argc, char* argv[]) { int wmain(int argc, wchar_t* argvU16[]) { // Initialize char* array with string-owned buffers std::string argvStr[argc]; - const char* argvU8[argc]; + const char* argvU8[argc + 1]; for (int i = 0; i < argc; i++) { argvStr[i] = string::UTF16toUTF8(argvU16[i]); argvU8[i] = argvStr[i].c_str(); } + argvU8[argc] = NULL; return main(argc, (char**) argvU8); } #endif