Cygwin: pty: Fix segfault caused when tcflush() is called.
- After commit 253352e796
, mc (midnight
commander) crashes with segfault if the shell is bash. This is due
to NULL pointer access in read(). This patch fixes the issue.
Addresses::
https://cygwin.com/pipermail/cygwin/2021-February/247870.html
This commit is contained in:
parent
246121534a
commit
18b91fbe58
|
@ -1474,9 +1474,12 @@ wait_retry:
|
||||||
out:
|
out:
|
||||||
termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
|
termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
|
||||||
len = (size_t) totalread;
|
len = (size_t) totalread;
|
||||||
|
if (ptr0)
|
||||||
|
{ /* Not tcflush() */
|
||||||
bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
|
bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
|
||||||
mask_switch_to_pcon_in (false, saw_eol);
|
mask_switch_to_pcon_in (false, saw_eol);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_pty_slave::dup (fhandler_base *child, int flags)
|
fhandler_pty_slave::dup (fhandler_base *child, int flags)
|
||||||
|
|
Loading…
Reference in New Issue