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

More strictness in ssh_channel_msg().

Now it disconnects if the server sends
SSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE for
a channel that isn't half-open.  Assertions in the SSH-2 handlers for
these messages rely on this behaviour even though it's never been
enforced before.
This commit is contained in:
Ben Harris 2016-05-22 22:57:25 +01:00
parent d17b9733a9
commit 08d4ca0787

6
ssh.c
View File

@ -7986,10 +7986,12 @@ static struct ssh_channel *ssh_channel_msg(Ssh ssh, struct Packet *pktin)
halfopen_ok = (pktin->type == SSH2_MSG_CHANNEL_OPEN_CONFIRMATION ||
pktin->type == SSH2_MSG_CHANNEL_OPEN_FAILURE);
c = find234(ssh->channels, &localid, ssh_channelfind);
if (!c || (c->type != CHAN_SHARING && c->halfopen && !halfopen_ok)) {
if (!c || (c->type != CHAN_SHARING && (c->halfopen != halfopen_ok))) {
char *buf = dupprintf("Received %s for %s channel %u",
ssh_pkt_type(ssh, pktin->type),
c ? "half-open" : "nonexistent", localid);
!c ? "nonexistent" :
c->halfopen ? "half-open" : "open",
localid);
ssh_disconnect(ssh, NULL, buf, SSH2_DISCONNECT_PROTOCOL_ERROR, FALSE);
sfree(buf);
return NULL;