mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
Tweak to window handling: Keep the local window in a signed integer, and
arrange to handle usefully the case where the server sends us more data than it's allowed to. There's no danger of overflow, since the maximum is OUR_V2_WINSIZE and the minimum is -OUR_V2_MAXPKT (at least if the server is nice). [originally from svn r7661]
This commit is contained in:
parent
6d2c196708
commit
f48e3eb16b
10
ssh.c
10
ssh.c
@ -551,7 +551,8 @@ struct ssh_channel {
|
|||||||
struct ssh2_data_channel {
|
struct ssh2_data_channel {
|
||||||
bufchain outbuffer;
|
bufchain outbuffer;
|
||||||
unsigned remwindow, remmaxpkt;
|
unsigned remwindow, remmaxpkt;
|
||||||
unsigned locwindow;
|
/* locwindow is signed so we can cope with excess data. */
|
||||||
|
int locwindow;
|
||||||
} v2;
|
} v2;
|
||||||
} v;
|
} v;
|
||||||
union {
|
union {
|
||||||
@ -6284,9 +6285,12 @@ static void ssh2_msg_channel_data(Ssh ssh, struct Packet *pktin)
|
|||||||
/*
|
/*
|
||||||
* If we are not buffering too much data,
|
* If we are not buffering too much data,
|
||||||
* enlarge the window again at the remote side.
|
* enlarge the window again at the remote side.
|
||||||
|
* If we are buffering too much, we may still
|
||||||
|
* need to adjust the window if the server's
|
||||||
|
* sent excess data.
|
||||||
*/
|
*/
|
||||||
if (bufsize < OUR_V2_WINSIZE)
|
ssh2_set_window(c, bufsize < OUR_V2_WINSIZE ?
|
||||||
ssh2_set_window(c, OUR_V2_WINSIZE - bufsize);
|
OUR_V2_WINSIZE - bufsize : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user