public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org> To: cygwin-cvs@sourceware.org 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: <20220805090407.E82333858D37@sourceware.org> (raw) 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 {
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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220805090407.E82333858D37@sourceware.org \ --to=tyan0@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe 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).