Cygwin: pty: Fix a small bug in is_console_app().

- Previsouly, there was potential risk of buffer over run in
  is_console_app(). This patch fixes the issue.
This commit is contained in:
Takashi Yano 2022-08-05 17:53:16 +09:00
parent 58e981a5a4
commit 249f42d07a
1 changed files with 1 additions and 1 deletions

View File

@ -224,7 +224,7 @@ is_console_app (WCHAR *filename)
ReadFile (h, buf, sizeof (buf), &n, 0);
CloseHandle (h);
char *p = (char *) memmem (buf, n, "PE\0\0", 4);
if (p && p + id_offset <= buf + n)
if (p && p + id_offset < buf + n)
return p[id_offset] == '\003'; /* 02: GUI, 03: console */
else
{