Skip to content

Commit 4c7a15b

Browse files
max630dscho
authored andcommitted
mingw: consider that UNICODE_STRING::Length counts bytes
UNICODE_STRING::Length field means size of buffer in bytes[1], despite of buffer itself being array of wchar_t. Because of that terminating zero is placed twice as far. Fix it. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa380518.aspx Signed-off-by: Max Kirillov <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7db5cb8 commit 4c7a15b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/winansi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static void detect_msys_tty(int fd)
638638
buffer, sizeof(buffer) - 2, &result)))
639639
return;
640640
name = nameinfo->Name.Buffer;
641-
name[nameinfo->Name.Length] = 0;
641+
name[nameinfo->Name.Length / sizeof(*name)] = 0;
642642

643643
/*
644644
* Check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX')

0 commit comments

Comments
 (0)