From a1ada5a792f6446b5e80b64e67f1b3c8fd5eb647 Mon Sep 17 00:00:00 2001 From: killua Date: Mon, 16 Mar 2026 17:43:20 +0400 Subject: [PATCH] fix: overwrite on null terminator --- src/source/parser/platform_parsers/windows_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/source/parser/platform_parsers/windows_parser.cpp b/src/source/parser/platform_parsers/windows_parser.cpp index fe865e9..c8cbf83 100644 --- a/src/source/parser/platform_parsers/windows_parser.cpp +++ b/src/source/parser/platform_parsers/windows_parser.cpp @@ -48,9 +48,9 @@ std::string utf8_from_wstring(const std::wstring &w) { ")"); } std::string out; - out.resize(needed - 1); + out.resize(needed); int written = - ::WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, w.c_str(), -1, out.data(), needed, nullptr, nullptr); + ::WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, w.c_str(), -1, out.data(), out.size(), nullptr, nullptr); if (written <= 0) { throw std::runtime_error( "WideCharToMultiByte convert failed, Error("s + windows_error_message(::GetLastError()) + ")" +