From 607e80591cdbf956e7d66eb88b09e6510d513f4f Mon Sep 17 00:00:00 2001 From: Raul Santelices Date: Thu, 18 Apr 2024 03:31:24 -0400 Subject: [PATCH] Fix for issue #910: Bad packet received by server when hearbeat is enabled (#911) * Fix for issue #910: Bad packet received by server when hearbeat is enabled * Address re-keying case too --------- Co-authored-by: Jeroen van Erp --- src/main/java/net/schmizz/sshj/transport/TransportImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java index 1cd6cb2b..e5738da9 100644 --- a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java +++ b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java @@ -420,9 +420,9 @@ public long write(SSHPacket payload) try { if (kexer.isKexOngoing()) { - // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST + // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST and IGNORE final Message m = Message.fromByte(payload.array()[payload.rpos()]); - if (!m.in(1, 49) || m == Message.SERVICE_REQUEST) { + if (!m.in(1, 49) || m == Message.SERVICE_REQUEST || m == Message.IGNORE) { assert m != Message.KEXINIT; kexer.waitForDone(); }