]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Be more careful of bombouts at the s_rdpkt level: if these happen
authorSimon Tatham <anakin@pobox.com>
Sun, 9 Sep 2001 14:47:29 +0000 (14:47 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 9 Sep 2001 14:47:29 +0000 (14:47 +0000)
(for example SSH_MSG_DISCONNECT) we should avoid even calling
ssh_protocol.

[originally from svn r1259]

ssh.c

diff --git a/ssh.c b/ssh.c
index 23cfdaac21e4b50276da56b22fbe5a3c00f20bf4..27b7216d32f3a3cec8412fc7718ca793eada82b8 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;