diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-08-05 17:53:16 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-08-05 17:59:40 +0900 |
commit | 249f42d07a447ceb6fe22db5a2570f913cb5b4e5 (patch) | |
tree | 49d8f8a237c438197d18f4111cc9eaecc7bce055 | |
parent | 58e981a5a42cd46ff52591d0394deeea9d3f01f0 (diff) | |
download | newlib-249f42d07a447ceb6fe22db5a2570f913cb5b4e5.zip newlib-249f42d07a447ceb6fe22db5a2570f913cb5b4e5.tar.gz newlib-249f42d07a447ceb6fe22db5a2570f913cb5b4e5.tar.bz2 |
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.
-rw-r--r-- | winsup/cygwin/spawn.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 7de9682..641f236 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -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 { |