Skip to content

Commit

Permalink
Fix off-by-one error
Browse files Browse the repository at this point in the history
  • Loading branch information
JerwuQu committed Jul 12, 2021
1 parent 5a5120e commit 218374f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,8 @@ void parseStdinEntries(state_t *state)

// Convert to utf16
const size_t charCount = MultiByteToWideChar(CP_UTF8, 0, stdinUtf8.data, stdinUtf8.count, 0, 0);
wchar_t *stdinUtf16 = xrealloc(0, charCount * 2);
memset(stdinUtf16, 0, charCount * 2);
wchar_t *stdinUtf16 = xrealloc(0, charCount * 2 + 1);
memset(stdinUtf16, 0, charCount * 2 + 1);
MultiByteToWideChar(CP_UTF8, 0, stdinUtf8.data, stdinUtf8.count, stdinUtf16, charCount);
free(stdinUtf8.data);

Expand Down

0 comments on commit 218374f

Please sign in to comment.