summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2016-12-19 23:32:00 +0200
committerJunio C Hamano <gitster@pobox.com>2016-12-20 09:04:57 -0800
commitc46458e82f0112ed288bcf89bea973b859e1854e (patch)
tree81aabd5e242f3d309885bdc78de35e71f6f9e757 /compat
parentf7f90e0f4f58d493242078d17c0eba41dd3f1f79 (diff)
downloadgit-c46458e82f0112ed288bcf89bea973b859e1854e.tar.gz
mingw: consider that UNICODE_STRING::Length counts bytesmk/mingw-winansi-ttyname-termination-fix
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 <max@max630.net> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/winansi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/winansi.c b/compat/winansi.c
index 3be60ce1c6..6b4f736fdc 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -553,7 +553,7 @@ static void detect_msys_tty(int fd)
buffer, sizeof(buffer) - 2, &result)))
return;
name = nameinfo->Name.Buffer;
- name[nameinfo->Name.Length] = 0;
+ name[nameinfo->Name.Length / sizeof(*name)] = 0;
/* check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX') */
if (!wcsstr(name, L"msys-") || !wcsstr(name, L"-pty"))