Add the CRC32 compensation attack detector that all other SSH
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 115c0ce..b8abc5b 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -724,6 +724,11 @@ static int ssh1_rdpkt(unsigned char **data, int *datalen)
        st->to_read -= st->chunk;
     }
 
+    if (cipher && detect_attack(pktin.data, st->biglen, NULL)) {
+        bombout(("Network attack (CRC compensation) detected!"));
+        crReturn(0);
+    }
+
     if (cipher)
        cipher->decrypt(pktin.data, st->biglen);