Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Don't completely ignore unknown types of SSH_MSG_CHANNEL_EXTENDED_DATA.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bjh21 committed May 24, 2016
1 parent f0f1914 commit 4115ab6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4115ab6

Please sign in to comment.