Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2023-08-14 13:48:12 +0300
committerTakashi Yano <takashi.yano@nifty.ne.jp>2023-08-16 02:33:47 +0300
commit2ee8de782b809c83c4261cc6e7e17bdaf31cff96 (patch)
treece468abc8bc8bba9918c2e46da396f738686041b /winsup
parent46c4a9072436b01f9239bbac2e9a24bc08755026 (diff)
Cygwin: pty: Add missing pinfo check in transfer_input().
The commit 10d083c745dd has a bug that lacks a check for pinfo pointer value for master_pid. This causes segmentation fault if the process whose pid is master_pid no longer exists. This patch fixes the issue. Fixes: 10d083c745dd ("Cygwin: pty: Inherit typeahead data between two input pipes.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/fhandler/pty.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index db3b77ecf..607333f52 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3835,7 +3835,9 @@ fhandler_pty_slave::transfer_input (tty::xfer_dir dir, HANDLE from, tty *ttyp,
to = ttyp->to_slave ();
pinfo p (ttyp->master_pid);
- HANDLE pty_owner = OpenProcess (PROCESS_DUP_HANDLE, FALSE, p->dwProcessId);
+ HANDLE pty_owner = NULL;
+ if (p)
+ pty_owner = OpenProcess (PROCESS_DUP_HANDLE, FALSE, p->dwProcessId);
if (pty_owner)
{
DuplicateHandle (pty_owner, to, GetCurrentProcess (), &to,