Skip to content

Commit a294764

Browse files
committed
Merge branch 'bugfix/slave_fix_crash_on_incorrect_state_on_collision' into 'master'
fix crash if incorrect state on collisions v1 Closes IDFGH-15008 See merge request idf/esp-modbus!115
2 parents 2c3aeab + 12d5401 commit a294764

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

freemodbus/modbus/rtu/mbrtu.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ xMBRTUReceiveFSM( void )
245245
BOOL xStatus = FALSE;
246246
UCHAR ucByte;
247247

248-
assert( eSndState == STATE_TX_IDLE );
248+
if ( eSndState != STATE_TX_IDLE ) {
249+
return FALSE;
250+
}
249251

250252
/* Always read the character. */
251253
xStatus = xMBPortSerialGetByte( ( CHAR * ) & ucByte );
@@ -307,7 +309,9 @@ xMBRTUTransmitFSM( void )
307309
{
308310
BOOL xNeedPoll = TRUE;
309311

310-
assert( eRcvState == STATE_RX_IDLE );
312+
if ( eRcvState != STATE_RX_IDLE ) {
313+
return FALSE;
314+
}
311315

312316
switch ( eSndState )
313317
{

idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.0.17"
1+
version: "1.0.18"
22
description: ESP-MODBUS is the official Modbus library for Espressif SoCs.
33
url: https://github.com/espressif/esp-modbus
44
dependencies:

0 commit comments

Comments
 (0)