1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

ssh2_try_send: don't try sending if a channel is half-open.

When ssh2_connection_filter_queue is _receiving_ messages about a
channel from the other end, it carefully checks if the channel
referred to is half-open. But we weren't exercising the same caution
before beginning to _send_ channel data, and we should, because in
that situation important fields like c->remwinsize aren't even
initialised yet.

This can come up, for example, due to typeahead in the main session
window before the server has sent OPEN_CONFIRMATION.
This commit is contained in:
Simon Tatham 2019-03-03 07:09:26 +00:00
parent 8c366766ae
commit deafaa811e

View File

@ -1060,6 +1060,7 @@ static size_t ssh2_try_send(struct ssh2_channel *c)
PktOut *pktout;
size_t bufsize;
if (!c->halfopen) {
while (c->remwindow > 0 &&
(bufchain_size(&c->outbuffer) > 0 ||
bufchain_size(&c->errbuffer) > 0)) {
@ -1085,6 +1086,7 @@ static size_t ssh2_try_send(struct ssh2_channel *c)
bufchain_consume(buf, data.len);
c->remwindow -= data.len;
}
}
/*
* After having sent as much data as we can, return the amount