From 3a3bee66ba945c6735d3064ee6362b15d6ea6535 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Tue, 5 Dec 2023 23:21:04 +0100 Subject: [PATCH] traintasticdiy: fix: hardware io handler dropped bytes of incomplete messages --- .../protocol/traintasticdiy/iohandler/hardwareiohandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/hardware/protocol/traintasticdiy/iohandler/hardwareiohandler.cpp b/server/src/hardware/protocol/traintasticdiy/iohandler/hardwareiohandler.cpp index 55f2b6a4..60f6fa44 100644 --- a/server/src/hardware/protocol/traintasticdiy/iohandler/hardwareiohandler.cpp +++ b/server/src/hardware/protocol/traintasticdiy/iohandler/hardwareiohandler.cpp @@ -65,7 +65,7 @@ void HardwareIOHandler::processRead(size_t bytesTransferred) while(drop < bytesTransferred) { message = reinterpret_cast(pos); - if(message->size() <= bytesTransferred && isChecksumValid(*message)) + if(message->size() > bytesTransferred || isChecksumValid(*message)) break; drop++;