From 30e97e092064278b2b90163d4a956ffcff3f701a Mon Sep 17 00:00:00 2001 From: aleks Date: Thu, 18 Jun 2020 12:33:02 +0200 Subject: [PATCH] freemodbus: fix memcmp result truncated to 1 byte Coverity ID: 291158 --- .../serial_master/modbus_controller/mbc_serial_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c b/components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c index 909f932fc6..ee81b532a7 100644 --- a/components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c +++ b/components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c @@ -361,7 +361,7 @@ static esp_err_t mbc_serial_master_set_request(char* name, mb_param_mode_t mode, 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;