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).
git-svn-id: svn://svn.tartarus.org/sgt/putty@7661
cda61777-01e9-0310-a592-
d414129be87e
struct ssh2_data_channel {
bufchain outbuffer;
unsigned remwindow, remmaxpkt;
struct ssh2_data_channel {
bufchain outbuffer;
unsigned remwindow, remmaxpkt;
+ /* locwindow is signed so we can cope with excess data. */
+ int locwindow;
/*
* If we are not buffering too much data,
* enlarge the window again at the remote side.
/*
* If we are not buffering too much data,
* 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, OUR_V2_WINSIZE - bufsize);
+ ssh2_set_window(c, bufsize < OUR_V2_WINSIZE ?
+ OUR_V2_WINSIZE - bufsize : 0);