From e2301f9b9e091e82bcc4a16ad72190dc029a2952 Mon Sep 17 00:00:00 2001 From: Petr <5851137+pvyleta@users.noreply.github.com> Date: Wed, 13 Nov 2019 00:20:28 +0100 Subject: [PATCH] Fixed not allowing empty length user data Current implementation is not allowing zero-lenght empty data, which is by no means forbiddedn by the standard. --- modbus/functions/mbfuncother.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modbus/functions/mbfuncother.c b/modbus/functions/mbfuncother.c index adbc85d..2101619 100644 --- a/modbus/functions/mbfuncother.c +++ b/modbus/functions/mbfuncother.c @@ -57,7 +57,7 @@ eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning, /* the first byte and second byte in the buffer is reserved for * the parameter ucSlaveID and the running flag. The rest of * the buffer is available for additional data. */ - if( usAdditionalLen + 2 < MB_FUNC_OTHER_REP_SLAVEID_BUF ) + if( usAdditionalLen + 2 <= MB_FUNC_OTHER_REP_SLAVEID_BUF ) { usMBSlaveIDLen = 0; ucMBSlaveID[usMBSlaveIDLen++] = ucSlaveID;