Fix total number of bytes in sanity check

This commit is contained in:
zontreck 2024-08-29 14:48:39 -07:00
parent a7e448f6b4
commit a7c1daf806
3 changed files with 4 additions and 4 deletions

View file

@ -31,7 +31,7 @@ class PacketServer {
var oldPos = layer.currentPosition;
layer.resetPosition();
int pktTotalExpected = layer.readLong();
if (pktTotalExpected <= layer.length) {
if (pktTotalExpected + 8 <= layer.length) {
// Allow Processing
} else {
layer.restorePosition(oldPos);
@ -184,7 +184,7 @@ class PacketClient {
var oldPos = reply.currentPosition;
reply.resetPosition();
int lenOfReply = reply.readLong();
if (lenOfReply <= reply.length) {
if (lenOfReply + 8 <= reply.length) {
// We can now process the data
} else {
reply.restorePosition(oldPos);