From 9226f789317d187a76f6833c0885ee5c4832c4d5 Mon Sep 17 00:00:00 2001 From: luosheng Date: Sun, 12 Feb 2023 08:10:09 +0800 Subject: [PATCH] DuplicateWithCount bug fix. --- Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs index b320fe4..d90baf3 100644 --- a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs +++ b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs @@ -32,6 +32,7 @@ namespace Modbus.Net { length = length * 256 + receiveMessage[pos + countPos]; } + if (length == 0) { break; } length += otherCount; if (pos + length > receiveMessage.Length) break; byte[] currentPackage = new byte[length];