public inbox for
help / color / mirror / Atom feed
From: Takashi Yano <>
Subject: [newlib-cygwin] Cygwin: pty: Fix a small bug in is_console_app().
Date: Fri,  5 Aug 2022 09:04:07 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=249f42d07a447ceb6fe22db5a2570f913cb5b4e5

commit 249f42d07a447ceb6fe22db5a2570f913cb5b4e5
Author: Takashi Yano <>
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.

 winsup/cygwin/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/ b/winsup/cygwin/
index 7de96827c..641f23642 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
@@ -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 */

                 reply	other threads:[~2022-08-05  9:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).