aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-10-22 14:05:40 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-10-22 14:19:01 +0900
commit08281cf4cca9593adcc3d30184322dc60fa1cd61 (patch)
tree09c030aa2677ba6d099e3668047cffa324e0fc37
parent1ca46b22d6edb3d469b51475e8b096d86deaac67 (diff)
downloadnewlib-github/cygwin-3_3-branch.zip
newlib-github/cygwin-3_3-branch.tar.gz
newlib-github/cygwin-3_3-branch.tar.bz2
Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'github/cygwin-3_3-branchcygwin-3_3-branch
- 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
-rw-r--r--winsup/cygwin/spawn.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index d9d7716..9725335 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,