[newlib-cygwin] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
Takashi Yano
tyan0@sourceware.org
Sat Oct 22 05:35:15 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7589034cc3151bfac8cc3d3af5e91402a78e160b
commit 7589034cc3151bfac8cc3d3af5e91402a78e160b
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 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,
More information about the Cygwin-cvs
mailing list