Skip to content

Commit 158ae5c

Browse files
committed
Merge branch 'bugfix/freemodbus_fix_memcmp_coveriity_id291158' into 'master'
freemodbus: bug fix memcmp result truncated to 1 byte (coveriity id291158) Closes IDF-1836 See merge request espressif/esp-idf!9239
2 parents cacb568 + 30e97e0 commit 158ae5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static esp_err_t mbc_serial_master_set_request(char* name, mb_param_mode_t mode,
361361
continue; // The length of strings is different then check next record in the table
362362
}
363363
// Compare the name of parameter with parameter key from table
364-
uint8_t comp_result = memcmp((const char*)name, (const char*)reg_ptr->param_key, (size_t)param_key_len);
364+
int comp_result = memcmp((const void*)name, (const void*)reg_ptr->param_key, (size_t)param_key_len);
365365
if (comp_result == 0) {
366366
// The correct line is found in the table and reg_ptr points to the found parameter description
367367
request->slave_addr = reg_ptr->mb_slave_addr;

0 commit comments

Comments
 (0)