diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-10-22 14:05:40 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-10-22 14:21:15 +0900 |
commit | 7589034cc3151bfac8cc3d3af5e91402a78e160b (patch) | |
tree | 946a7a7949fafd52ceab8bb97cc1c9efb58e19b3 | |
parent | 8c87ffd372232476ac5d1705dd32ddda54134c2b (diff) | |
download | newlib-7589034cc3151bfac8cc3d3af5e91402a78e160b.zip newlib-7589034cc3151bfac8cc3d3af5e91402a78e160b.tar.gz newlib-7589034cc3151bfac8cc3d3af5e91402a78e160b.tar.bz2 |
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
-rw-r--r-- | winsup/cygwin/spawn.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 5aa52ab..4fc842a 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, |