Skip to content

Commit

Permalink
Merge pull request #3875 from 1480c1/wine/detect_msys_tty
Browse files Browse the repository at this point in the history
winansi: check result before using Name for pty
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Nov 25, 2024
2 parents 28c1687 + 8071d96 commit ad3f55a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ static void detect_msys_tty(int fd)
if (!NT_SUCCESS(NtQueryObject(h, ObjectNameInformation,
buffer, sizeof(buffer) - 2, &result)))
return;
if (result < sizeof(*nameinfo) || !nameinfo->Name.Buffer ||
!nameinfo->Name.Length)
return;
name = nameinfo->Name.Buffer;
name[nameinfo->Name.Length / sizeof(*name)] = 0;

Expand Down

0 comments on commit ad3f55a

Please sign in to comment.