Allow sending data payloads of remote_maxpacket length.

Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Tom Deseyn
2023-07-18 07:48:50 +02:00
committed by Jakub Jelen
parent 60db508054
commit 6a64f5a11a

View File

@@ -1502,7 +1502,6 @@ static int channel_write_common(ssh_channel channel,
ssh_session session;
uint32_t origlen = len;
size_t effectivelen;
size_t maxpacketlen;
int rc;
if(channel == NULL) {
@@ -1520,12 +1519,6 @@ static int channel_write_common(ssh_channel channel,
return SSH_ERROR;
}
/*
* Handle the max packet len from remote side, be nice
* 10 bytes for the headers
*/
maxpacketlen = channel->remote_maxpacket - 10;
if (channel->local_eof) {
ssh_set_error(session, SSH_REQUEST_DENIED,
"Can't write to channel %" PRIu32 ":%" PRIu32 " after EOF was sent",
@@ -1576,7 +1569,11 @@ static int channel_write_common(ssh_channel channel,
effectivelen = len;
}
effectivelen = MIN(effectivelen, maxpacketlen);
/*
* Like OpenSSH, don't subtract bytes for the header fields
* and allow to send a payload of remote_maxpacket length.
*/
effectivelen = MIN(effectivelen, channel->remote_maxpacket);
rc = ssh_buffer_pack(session->out_buffer,
"bd",