Skip to content

Commit 9ae52a1

Browse files
author
Z
committed
fix: random data poisoning last byte of the coils response
1 parent 8321f2d commit 9ae52a1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ModbusRtu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,7 @@ int8_t Modbus::process_FC1( uint16_t *regs, uint8_t u8size )
12031203
if (u16Coilno % 8 != 0) u8bytesno ++;
12041204
au8Buffer[ ADD_HI ] = u8bytesno;
12051205
u8BufferSize = ADD_LO;
1206+
au8Buffer[ u8BufferSize + u8bytesno - 1 ] = 0;
12061207

12071208
// read each coil from the register map and put its value inside the outcoming message
12081209
u8bitsno = 0;

0 commit comments

Comments
 (0)