public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
@ 2022-10-22  5:34 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-10-22  5:34 UTC (permalink / raw)
  To: cygwin-cvs

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

commit 08281cf4cca9593adcc3d30184322dc60fa1cd61
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Sat Oct 22 14:05:40 2022 +0900

    Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
    
    - 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

Diff:
---
 winsup/cygwin/spawn.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index d9d771651..972533554 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -198,6 +198,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,

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

only message in thread, other threads:[~2022-10-22  5:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  5:34 [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir' 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).