Be more careful of bombouts at the s_rdpkt level: if these happen
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 9 Sep 2001 14:47:29 +0000 (14:47 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 9 Sep 2001 14:47:29 +0000 (14:47 +0000)
(for example SSH_MSG_DISCONNECT) we should avoid even calling
ssh_protocol.

git-svn-id: svn://svn.tartarus.org/sgt/putty@1259 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index 23cfdaa..27b7216 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -726,6 +726,7 @@ static int ssh1_rdpkt(unsigned char **data, int *datalen)
        buf[nowlen + msglen] = '\0';
        logevent(buf);
        bombout(("Server sent disconnect message:\n\"%s\"", buf+nowlen));
+       crReturn(0);
     }
 
     crFinish(0);
@@ -904,6 +905,7 @@ static int ssh2_rdpkt(unsigned char **data, int *datalen)
                 (reason > 0 && reason < lenof(ssh2_disconnect_reasons)) ?
                 ssh2_disconnect_reasons[reason] : "unknown",
                 buf+nowlen));
+       crReturn(0);
     }
 
     crFinish(0);
@@ -1600,6 +1602,9 @@ static void ssh_gotdata(unsigned char *data, int datalen)
     while (1) {
        while (datalen > 0) {
            if (s_rdpkt(&data, &datalen) == 0) {
+               if (ssh_state == SSH_STATE_CLOSED) {
+                   return;
+               }
                ssh_protocol(NULL, 0, 1);
                if (ssh_state == SSH_STATE_CLOSED) {
                    return;