Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,16 @@ VOID Print (LPWSTR messagew)
const size_t MAXMESSAGELENGTH = 5119;
size_t count = 0;
CHAR messagea [MAXMESSAGELENGTH + 1];
if (wcstombs_s(&count, messagea, MAXMESSAGELENGTH + 1, messagew, _TRUNCATE) != 0) {
if (wcstombs_s(&count, messagea, MAXMESSAGELENGTH + 1, messagew, MAXMESSAGELENGTH) != 0) {
// Failed to convert the Unicode message to ASCII.
assert(FALSE);
return;
}
if (count >= MAXMESSAGELENGTH)
{
Report(L"!!! Print Warning, the message was too long and has been truncated.\n");
}

messagea[MAXMESSAGELENGTH] = '\0';

if (s_reportFile != NULL) {
Expand Down