From 4115ab6e2e3ddd22eda230fc7b2c27781064d38a Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 24 May 2016 22:38:40 +0100 Subject: [PATCH] Don't completely ignore unknown types of SSH_MSG_CHANNEL_EXTENDED_DATA. It's important to do the usual window accounting in all cases. We still ignore the data themselves, which I think is the right thing to do. --- ssh.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ssh.c b/ssh.c index 13ce0ce4..15c53a62 100644 --- a/ssh.c +++ b/ssh.c @@ -8064,20 +8064,21 @@ static void ssh2_msg_channel_data(Ssh ssh, struct Packet *pktin) { char *data; int length; + unsigned ext_type = 0; /* 0 means not extended */ struct ssh_channel *c; c = ssh_channel_msg(ssh, pktin); if (!c) return; - if (pktin->type == SSH2_MSG_CHANNEL_EXTENDED_DATA && - ssh_pkt_getuint32(pktin) != SSH2_EXTENDED_DATA_STDERR) - return; /* extended but not stderr */ + if (pktin->type == SSH2_MSG_CHANNEL_EXTENDED_DATA) + ext_type = ssh_pkt_getuint32(pktin); ssh_pkt_getstring(pktin, &data, &length); if (data) { int bufsize; c->v.v2.locwindow -= length; c->v.v2.remlocwin -= length; - bufsize = ssh_channel_data(c, pktin->type == - SSH2_MSG_CHANNEL_EXTENDED_DATA, + if (ext_type != 0 && ext_type != SSH2_EXTENDED_DATA_STDERR) + length = 0; /* Don't do anything with unknown extended data. */ + bufsize = ssh_channel_data(c, ext_type == SSH2_EXTENDED_DATA_STDERR, data, length); /* * If it looks like the remote end hit the end of its window,