network: forbid packets with length <= 0

This commit is contained in:
Moritz Zwerger 2023-10-28 23:01:58 +02:00
parent 4773311260
commit 3adc8d919e
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -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)
}