Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4118598

Browse filesBrowse files
seishunevanlucas
authored andcommitted
src: don't include a null character in the WriteConsoleW call
Fixes: #7755 PR-URL: #7764 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 92de0bc commit 4118598
Copy full SHA for 4118598

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ static void PrintErrorString(const char* format, ...) {
258258

259259
std::vector<wchar_t> wbuf(n);
260260
MultiByteToWideChar(CP_UTF8, 0, out.data(), -1, wbuf.data(), n);
261-
WriteConsoleW(stderr_handle, wbuf.data(), n, nullptr, nullptr);
261+
262+
// Don't include the null character in the output
263+
CHECK_GT(n, 0);
264+
WriteConsoleW(stderr_handle, wbuf.data(), n - 1, nullptr, nullptr);
262265
#else
263266
vfprintf(stderr, format, ap);
264267
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.