Merge branch 'bugfix/freemodbus_fix_pvs_studio_auto_merge_issues' into 'master'

freemodbus: PVS-studio fix potential loss of significant bits and auto merge issues

Closes IDF-2732

See merge request espressif/esp-idf!12334
This commit is contained in:
Alex Lisitsyn 2021-07-29 08:00:24 +00:00
commit ea40a59d31
2 changed files with 2 additions and 2 deletions

View File

@ -184,7 +184,7 @@ eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
usRegAddress++;
usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 );
usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
/* Check if the number of registers to read is valid. If not
* return Modbus illegal data value exception.

View File

@ -384,7 +384,7 @@ static esp_err_t mbc_tcp_master_set_request(char* name, mb_param_mode_t mode, mb
continue; // The length of strings is different then check next record in the table
}
// Compare the name of parameter with parameter key from table
uint8_t comp_result = memcmp((const char*)name, (const char*)reg_ptr->param_key, (size_t)param_key_len);
int comp_result = memcmp((const void*)name, (const void*)reg_ptr->param_key, (size_t)param_key_len);
if (comp_result == 0) {
// The correct line is found in the table and reg_ptr points to the found parameter description
request->slave_addr = reg_ptr->mb_slave_addr;