summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-12-27 00:11:44 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-12-27 00:11:44 -0800
commitc5139e0e3811ea3f6014187e76b243ccf287cb83 (patch)
treefc7dbdc4d06dce74fd346cd873eb9ae80a68e28d
parentMerge branch 'gv/p4-multi-path-commit-fix' (diff)
parentmingw: consider that UNICODE_STRING::Length counts bytes (diff)
downloadtgif-c5139e0e3811ea3f6014187e76b243ccf287cb83.tar.xz
Merge branch 'mk/mingw-winansi-ttyname-termination-fix'
A potential but unlikely buffer overflow in Windows port has been fixed. * mk/mingw-winansi-ttyname-termination-fix: mingw: consider that UNICODE_STRING::Length counts bytes
-rw-r--r--compat/winansi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/winansi.c b/compat/winansi.c
index cb725fb02f..97d84a96ed 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -556,7 +556,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"))