From 0c2403fda75a479e8f8953fa6cca58ef25e98bfa Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Mon, 3 Jun 2024 20:20:34 +0200 Subject: [PATCH] Minor simplification in packet decoding No need to divide two equal values; just increment the block count. --- .../apache/sshd/common/session/helpers/AbstractSession.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java index 921e28733..4dfb8e620 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java @@ -1589,9 +1589,7 @@ protected void decode() throws Exception { } else if ((inCipher != null) && (!etmMode)) { // Decrypt the first bytes so we can extract the packet length inCipher.update(decoderBuffer.array(), 0, inCipherSize); - - int blocksCount = inCipherSize / inCipher.getCipherBlockSize(); - inBlocksCount.addAndGet(Math.max(1, blocksCount)); + inBlocksCount.incrementAndGet(); } // Read packet length decoderLength = decoderBuffer.getInt();