public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
@ 2022-10-22  5:34 Takashi Yano
  2022-10-22  5:58 ` Johannes Schindelin
  0 siblings, 1 reply; 8+ messages in thread
From: Takashi Yano @ 2022-10-22  5:34 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Takashi Yano

- If the command executed is 'cmd.exe /c [...]', runpath in spawn.cc
  will be NULL. In this case, is_console_app(runpath) check causes
  access violation. This case also the command executed is obviously
  console app., therefore, treat it as console app to fix this issue.

  Addresses: https://github.com/msys2/msys2-runtime/issues/108
---
 winsup/cygwin/spawn.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 5aa52ab1e..4fc842a2b 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -215,6 +215,8 @@ handle (int fd, bool writing)
 static bool
 is_console_app (WCHAR *filename)
 {
+  if (filename == NULL)
+    return true; /* The command executed is command.com or cmd.exe. */
   HANDLE h;
   const int id_offset = 92;
   h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ,
-- 
2.37.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-21 11:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  5:34 [PATCH] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir' Takashi Yano
2022-10-22  5:58 ` Johannes Schindelin
2022-10-22  6:12   ` Takashi Yano
2022-10-23 20:42     ` Johannes Schindelin
2022-10-24  9:28       ` Corinna Vinschen
2022-11-18  8:23         ` Johannes Schindelin
2022-11-19 21:38           ` Jeremy Drake
2022-11-21 11:47           ` Corinna Vinschen

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).