diff --git a/src/node.cc b/src/node.cc index 06ce9ca6d0c..5cab485bbd7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -257,7 +257,10 @@ static void PrintErrorString(const char* format, ...) { std::vector wbuf(n); MultiByteToWideChar(CP_UTF8, 0, out.data(), -1, wbuf.data(), n); - WriteConsoleW(stderr_handle, wbuf.data(), n, nullptr, nullptr); + + // Don't include the null character in the output + CHECK_GT(n, 0); + WriteConsoleW(stderr_handle, wbuf.data(), n - 1, nullptr, nullptr); #else vfprintf(stderr, format, ap); #endif