]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Sat, 22 Oct 2022 05:05:40 +0000 (14:05 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Sat, 22 Oct 2022 05:21:15 +0000 (14:21 +0900)
- 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

index 5aa52ab1ee30f4e08143fce9f53f2ba073427334..4fc842a2b26543c0eccb05fb468d22ffd072b4ad 100644 (file)
@@ -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,
This page took 0.031845 seconds and 5 git commands to generate.