1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2026-10-24 03:48:55 +03:00

channels: Avoid remote window overflow

Reported-by: Rinku Das <rinkudaskajal7857@gmail.com>
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit d0f5747ab7)
This commit is contained in:
Jakub Jelen
2026-03-05 17:35:10 +01:00
committed by Pavol Žáčik
parent 69fb4bd006
commit 49df3fa0dc

View File

@@ -565,6 +565,15 @@ SSH_PACKET_CALLBACK(channel_rcv_change_window)
was_empty = channel->remote_window == 0;
if (UINT32_MAX - channel->remote_window < bytes) {
ssh_set_error(session,
SSH_FATAL,
"Window adjust %" PRIu32 " overflows remote window.",
bytes);
session->session_state = SSH_SESSION_STATE_ERROR;
return SSH_PACKET_USED;
}
channel->remote_window += bytes;
/* Writing to the channel is non-blocking until the receive window is empty.