Cygwin: pty: Add missing pinfo check in transfer_input().
The commit10d083c745
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:10d083c745
("Cygwin: pty: Inherit typeahead data between two input pipes.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
46c4a90724
commit
2ee8de782b
|
@ -3835,7 +3835,9 @@ fhandler_pty_slave::transfer_input (tty::xfer_dir dir, HANDLE from, tty *ttyp,
|
||||||
to = ttyp->to_slave ();
|
to = ttyp->to_slave ();
|
||||||
|
|
||||||
pinfo p (ttyp->master_pid);
|
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)
|
if (pty_owner)
|
||||||
{
|
{
|
||||||
DuplicateHandle (pty_owner, to, GetCurrentProcess (), &to,
|
DuplicateHandle (pty_owner, to, GetCurrentProcess (), &to,
|
||||||
|
|
Loading…
Reference in New Issue