public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Fix a small bug in is_console_app().
@ 2022-08-05  9:04 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-08-05  9:04 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=32d4afa4a3e25a44dc67cac586c924c3a2fc16a3

commit 32d4afa4a3e25a44dc67cac586c924c3a2fc16a3
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 4ec6a8789..d9d771651 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -207,7 +207,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
     {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-05  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05  9:04 [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Fix a small bug in is_console_app() Takashi Yano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).