From ede1f01752acf9bd03b7feb01ef0e5904d0dcd90 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 26 Aug 2020 13:10:40 -0700 Subject: [PATCH] SendChannel fix When changing the functions SendChannelData() and SendChannelAdjustWindow() to use the self channel ID instead of the peer channel ID, forgot to update a couple instances. The test case at the time had matching ID numbers for self and peer and happened to work. --- src/internal.c | 2 +- src/ssh.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/internal.c b/src/internal.c index fc26891..08aa29a 100644 --- a/src/internal.c +++ b/src/internal.c @@ -4839,7 +4839,7 @@ static int DoChannelExtendedData(WOLFSSH* ssh, DumpOctetString(buf + begin, dataSz); #endif if (ret == WS_SUCCESS) { - ret = SendChannelWindowAdjust(ssh, channel->peerChannel,dataSz); + ret = SendChannelWindowAdjust(ssh, channel->channel, dataSz); } } *idx = begin + dataSz; diff --git a/src/ssh.c b/src/ssh.c index 14557d7..34f14c1 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -1026,8 +1026,7 @@ int wolfSSH_stream_read(WOLFSSH* ssh, byte* buf, word32 bufSz) inputBuffer->buffer + bytesToAdd, usedSz); } - sendResult = SendChannelWindowAdjust(ssh, - ssh->channelList->peerChannel, + sendResult = SendChannelWindowAdjust(ssh, ssh->channelList->channel, bytesToAdd); if (sendResult != WS_SUCCESS) bufSz = sendResult; @@ -1093,7 +1092,7 @@ int wolfSSH_stream_send(WOLFSSH* ssh, byte* buf, word32 bufSz) return (ret == WS_SUCCESS)? bytesTxd : ret; } - bytesTxd = SendChannelData(ssh, ssh->channelList->peerChannel, buf, bufSz); + bytesTxd = SendChannelData(ssh, ssh->channelList->channel, buf, bufSz); WLOG(WS_LOG_DEBUG, "Leaving wolfSSH_stream_send(), txd = %d", bytesTxd); return bytesTxd; @@ -1876,8 +1875,7 @@ int wolfSSH_ChannelRead(WOLFSSH_CHANNEL* channel, byte* buf, word32 bufSz) inputBuffer->buffer + bytesToAdd, usedSz); } - sendResult = SendChannelWindowAdjust(channel->ssh, - channel->peerChannel, + sendResult = SendChannelWindowAdjust(channel->ssh, channel->channel, bytesToAdd); if (sendResult != WS_SUCCESS) bufSz = sendResult; @@ -1916,7 +1914,7 @@ int wolfSSH_ChannelSend(WOLFSSH_CHANNEL* channel, } else { WLOG(WS_LOG_DEBUG, "Sending data."); - bytesTxd = SendChannelData(channel->ssh, channel->peerChannel, + bytesTxd = SendChannelData(channel->ssh, channel->channel, (byte*)buf, bufSz); }