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 committed Jan 7, 2025
2 parents 5f7c8b5 + beb405d commit 19b3444
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 @@ -575,6 +575,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 19b3444

Please sign in to comment.