From 3adc8d919ec06e3d58d141b0342bfb0575077221 Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Sat, 28 Oct 2023 23:01:58 +0200 Subject: [PATCH] network: forbid packets with length <= 0 --- .../network/client/netty/pipeline/length/LengthDecoder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/protocol/network/network/client/netty/pipeline/length/LengthDecoder.kt b/src/main/java/de/bixilon/minosoft/protocol/network/network/client/netty/pipeline/length/LengthDecoder.kt index c84fdbdf5..06d0159b0 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/network/network/client/netty/pipeline/length/LengthDecoder.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/network/network/client/netty/pipeline/length/LengthDecoder.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2022 Moritz Zwerger + * Copyright (C) 2020-2023 Moritz Zwerger * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * @@ -37,7 +37,7 @@ class LengthDecoder( return } - if (length > maxLength) { + if (length <= 0 || length > maxLength) { throw PacketTooLongException(length, maxLength) }