Skip to content

Commit ead1b39

Browse files
authored
Merge pull request #37 from ogurets/master
fix: random data poisoning last byte of the coils response
2 parents 8321f2d + 9ae52a1 commit ead1b39

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)