[newlib-cygwin] Cygwin: pty: Fix a small bug in is_console_app().
Takashi Yano
tyan0@sourceware.org
Fri Aug 5 09:04:07 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=249f42d07a447ceb6fe22db5a2570f913cb5b4e5
commit 249f42d07a447ceb6fe22db5a2570f913cb5b4e5
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Fri Aug 5 17:53:16 2022 +0900
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.
Diff:
---
winsup/cygwin/spawn.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 7de96827c..641f23642 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
{
More information about the Cygwin-cvs
mailing list