Improve channel_rcv_change_window().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@677 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-05-02 20:51:57 +00:00
parent a7732ebbe5
commit 06eceb3204

View File

@@ -304,20 +304,25 @@ static CHANNEL *channel_from_msg(SSH_SESSION *session) {
}
static void channel_rcv_change_window(SSH_SESSION *session) {
u32 bytes;
CHANNEL *channel;
int err;
u32 bytes;
int rc;
enter_function();
channel = channel_from_msg(session);
if(!channel)
ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
err = buffer_get_u32(session->in_buffer,&bytes);
if(!channel || err!= sizeof(u32)){
if (channel == NULL) {
ssh_log(session, SSH_LOG_FUNCTIONS, ssh_get_error(session));
}
rc = buffer_get_u32(session->in_buffer, &bytes);
if (channel == NULL || rc != sizeof(u32)) {
ssh_log(session, SSH_LOG_PACKET,
"Error getting a window adjust message: invalid packet");
leave_function();
return;
}
bytes = ntohl(bytes);
ssh_log(session, SSH_LOG_PROTOCOL,
"Adding %d bytes to channel (%d:%d) (from %d bytes)",
@@ -325,7 +330,9 @@ static void channel_rcv_change_window(SSH_SESSION *session){
channel->local_channel,
channel->remote_channel,
channel->remote_window);
channel->remote_window += bytes;
leave_function();
}