Merge branch 'mk/mingw-winansi-ttyname-termination-fix' into maint
[git/git.git] / compat / winansi.c
index 477209f..3c9ed3c 100644 (file)
@@ -540,7 +540,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')